fix
This commit is contained in:
parent
4137695876
commit
44a14b6d77
@ -39,6 +39,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
||||
var paymeants = _paymeantstorage.GetFillteredList(new PaymeantSearchModel {
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
ClientID = model.ClientID,
|
||||
});
|
||||
|
||||
List<ReportProductsViewModel>? products = new();
|
||||
@ -91,7 +92,6 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
||||
TotalCount = 0
|
||||
};
|
||||
|
||||
foreach (var payment in paymeants) {
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel { ID = paymeant.OrderID })
|
||||
?? throw new Exception("Ошибка полуения данных");
|
||||
|
||||
@ -99,7 +99,6 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
||||
record.Products.Add(new(product.Value.Item1.ProductName, product.Value.Item2));
|
||||
record.TotalCount += product.Value.Item2;
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(record);
|
||||
}
|
||||
|
@ -13,5 +13,6 @@ namespace ElectronicsShopContracts.BindingModels
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public int ClientID { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +113,19 @@ namespace ElectronicsShopRestAPI.Controllers {
|
||||
}
|
||||
|
||||
_payLogic.CreatePay(model);
|
||||
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
||||
|
||||
if (order == null) {
|
||||
throw new Exception("Ошибка получения данных");
|
||||
}
|
||||
|
||||
_orderLogic.Update(new OrderBindingModel {
|
||||
ID = order.ID,
|
||||
ClientID = order.ClientID,
|
||||
DateCreate = order.DateCreate,
|
||||
Sum = order.Sum - model.SumPayment,
|
||||
ProductList = order.ProductList,
|
||||
});
|
||||
}
|
||||
|
||||
if (model.PayOption == 0) {
|
||||
@ -126,26 +139,11 @@ namespace ElectronicsShopRestAPI.Controllers {
|
||||
ID = model.OrderID,
|
||||
ClientID = order.ClientID,
|
||||
DateCreate = order.DateCreate,
|
||||
Sum = order.Sum - model.SumPayment,
|
||||
Sum = order.Sum,
|
||||
ProductList = order.ProductList,
|
||||
Status = OrderStatus.Оплачено
|
||||
});
|
||||
}
|
||||
else {
|
||||
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
||||
|
||||
if (order == null) {
|
||||
throw new Exception("Ошибка получения данных");
|
||||
}
|
||||
|
||||
_orderLogic.Update(new OrderBindingModel {
|
||||
ID = order.ID,
|
||||
ClientID = order.ClientID,
|
||||
DateCreate = order.DateCreate,
|
||||
Sum = order.Sum - model.SumPayment,
|
||||
ProductList = order.ProductList,
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания оплаты");
|
||||
|
Binary file not shown.
@ -274,6 +274,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
return PaymeantOption.Íåîïëà÷åíî;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public double Calc(int count, int product) {
|
||||
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
||||
@ -333,7 +334,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
APIClient.PostRequest("api/client/SendReportMail", new ReportBindingModel {
|
||||
ClientEmail = APIClient.Client?.Email ?? throw new Exception("Îøèáêà ïîëó÷åíèÿ àäðåñà"),
|
||||
DateFrom = DateTime.Parse(DateFrom),
|
||||
DateTo = DateTime.Parse(DateTo)
|
||||
DateTo = DateTime.Parse(DateTo),
|
||||
ClientID = APIClient.Client.ID
|
||||
});
|
||||
return View("Report");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user