This commit is contained in:
mmrbnjd
2024-07-27 23:20:15 +03:30
parent 97c30ce438
commit 888b63dcd4
6 changed files with 132 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
using Front.Services;
using BlazorBootstrap;
using Front.Services;
using Shared.DTOs;
using System.Net.Http.Json;
using System.Security.Cryptography;
@@ -16,6 +17,9 @@ namespace Front
private CompanyDTO? InfoCompany = null;
public InvoiceDTO? invoice { get; set; } = null;
public DashBoardDTO? dashBoard { get; set; } = null;
private List<PromotionDto>? Promotions { get; set; } = null;
private List<PricingDto>? Pricing { get; set; } = null;
public Fixedvalues(HttpClientController hc)
{
_hc = hc;
@@ -77,7 +81,7 @@ namespace Front
return InfoCompany;
}
public async Task<DashBoardDTO?> GetDashBoard(bool run=false)
public async Task<DashBoardDTO?> GetDashBoard(bool run = false)
{
if (dashBoard == null || run)
@@ -106,10 +110,32 @@ namespace Front
}
public async Task SetUlr(string Type)
{
await _hc.Post<UlrDto>("Base/Ulr",new UlrDto { Type=Type});
await _hc.Post<UlrDto>("Base/Ulr", new UlrDto { Type = Type });
}
public async Task<List<PricingDto>> LoadPricing()
{
if (Pricing == null)
{
var rsp = await _hc.Get($"Orders/GetAllPricing");
if (rsp.IsSuccessStatusCode)
Pricing = await rsp.Content.ReadFromJsonAsync<List<PricingDto>>();
}
return Pricing ?? new List<PricingDto>() ;
}
public async Task<List<PromotionDto>> LoadPromotion()
{
if(Promotions==null)
{var rsp = await _hc.Get($"Orders/GetAllPromotion");
if (rsp.IsSuccessStatusCode)
Promotions = await rsp.Content.ReadFromJsonAsync<List<PromotionDto>>();
}
return Promotions?? new List<PromotionDto>();
}
}