This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Refit; | |
using FinaFlow.Core.Entities; | |
namespace FinaFlow.Services; | |
public interface ICategoryService | |
{ | |
[Post("/v1/categories/")] | |
Task CreateAsync([Body] Category category); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using RestSharp; | |
using FinaFlow.Core.Entities; | |
namespace FinaFlow.Services; | |
public class CategoryService | |
{ | |
private readonly RestClient _client; | |
public CategoryService(IHttpClientFactory httpClientFactory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http.Json; | |
using FinaFlow.Core.Entities; | |
namespace FinaFlow.Services; | |
public class CategoryService( | |
IHttpClientFactory httpClientFactory) | |
{ | |
public async Task CreateAsync( | |
Category category) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exemplo de variáveis | |
let a = 10; | |
let b: u32 = 20; | |
let c = a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var minhaLista = new List<Food> { | |
new Food { Type = "Mineira"}, | |
new Food { Type = "Italiana"}, | |
new Food { Type = "Japonesa"} | |
}; | |
for (int i = 0; i <= minhaLista.Count; i++) | |
{ | |
var item = minhaLista[i]; | |
Console.WriteLine(item.Type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lista de strings | |
var minhaLista = new List<string> { "arroz", "feijão", "banana" }; | |
// Quero iterar sobre esta lista | |
// Utilizando for, precisamos de um contador (No caso i) | |
// Sabendo que os arrays no C# começam do ZERO... | |
// Então é uma boa prática começar i como zero | |
// Contamos até que i seja menor que 3 (Total de itens da lista) | |
for (int i = 0; i < 3; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var orders = new List<Order> | |
{ | |
new("Order 1 -10 itens", GenerateOrderLines(9)), | |
new("Order 2 +10 itens ", GenerateOrderLines(12)), | |
new("Order 3 +10 itens", GenerateOrderLines(18)), | |
new("Order 4 +10 itens", GenerateOrderLines(22)) | |
}; | |
List<OrderLine> GenerateOrderLines(int quantity) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Services.AddControllers() | |
.ConfigureApiBehaviorOptions(options => | |
{ | |
options.SuppressModelStateInvalidFilter = true; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateTimeExtension | |
{ | |
public static bool IsWeekend(this DateTime date) => date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday; | |
public static bool IsHoliday(this DateTime date, IEnumerable<DateTime> holidays) => holidays.Any(x => x == date); | |
public static DateTime Normalize(this DateTime date, IEnumerable<DateTime> holidays) | |
{ | |
while (date.IsHoliday(holidays) || date.IsWeekend()) | |
{ |
NewerOlder