...
This commit is contained in:
@@ -18,8 +18,8 @@ namespace Front
|
||||
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;
|
||||
private List<PromotionDto> Promotions { get; set; } = null;
|
||||
|
||||
public Fixedvalues(HttpClientController hc)
|
||||
{
|
||||
_hc = hc;
|
||||
@@ -114,26 +114,41 @@ namespace Front
|
||||
|
||||
|
||||
|
||||
}
|
||||
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 (Promotions == null)
|
||||
{
|
||||
List<PricingDto> Pricing = new List<PricingDto>();
|
||||
var rsp = await _hc.Get($"Orders/GetAllPromotion");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
Promotions = await rsp.Content.ReadFromJsonAsync<List<PromotionDto>>();
|
||||
{
|
||||
Promotions = await rsp.Content.ReadFromJsonAsync<List<PromotionDto>>() ?? new List<PromotionDto>();
|
||||
|
||||
rsp = await _hc.Get($"Orders/GetAllPricing");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
Pricing = await rsp.Content.ReadFromJsonAsync<List<PricingDto>>() ?? new List<PricingDto>();
|
||||
|
||||
if (Pricing.Count>0)
|
||||
{
|
||||
Promotions.Add(new PromotionDto()
|
||||
{
|
||||
ID = -1,
|
||||
Name = "شخصی",
|
||||
promotionDetails = Pricing.Select(s => new PromotionDetailDto
|
||||
{
|
||||
ID = 0,
|
||||
APrice = s.Price,
|
||||
CreditAmount = 0,
|
||||
PermissionID = s.PermissionID,
|
||||
PermissionTitle = s.PermissionTitle
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Promotions?? new List<PromotionDto>();
|
||||
return Promotions ?? new List<PromotionDto>();
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user