Skip to content

Instantly share code, notes, and snippets.

View andrebaltieri's full-sized avatar
🏠
Working from home

Andre Baltieri andrebaltieri

🏠
Working from home
View GitHub Profile
<link rel="stylesheet" href="bootstrap/bootstrap.min.bpk8xqwxhs.css" />
<link rel="stylesheet" href="app.da95v2qkru.css" />
<link rel="stylesheet" href="BlazorNewStaticFiles.f5ewiwg5xa.styles.css" />
<link rel="stylesheet" href="@Assets["bootstrap/bootstrap.min.css"]" />
<link rel="stylesheet" href="@Assets["app.css"]" />
<link rel="stylesheet" href="@Assets["BlazorNewStaticFiles.styles.css"]" />
<ImportMap />
using Refit;
using FinaFlow.Core.Entities;
namespace FinaFlow.Services;
public interface ICategoryService
{
[Post("/v1/categories/")]
Task CreateAsync([Body] Category category);
using RestSharp;
using FinaFlow.Core.Entities;
namespace FinaFlow.Services;
public class CategoryService
{
private readonly RestClient _client;
public CategoryService(IHttpClientFactory httpClientFactory)
using System.Net.Http.Json;
using FinaFlow.Core.Entities;
namespace FinaFlow.Services;
public class CategoryService(
IHttpClientFactory httpClientFactory)
{
public async Task CreateAsync(
Category category)
// Exemplo de variáveis
let a = 10;
let b: u32 = 20;
let c = a + b;
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);
// 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++)
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
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)
{