Beispiel #1
0
 /// <summary>
 /// Method calculates sale total and tax.
 /// </summary>
 /// <param name="sale">Method takes on SaleDTO as an argument.</param>
 /// <returns></returns>
 public SaleDTO FinalizeSale(SaleDTO sale)
 {
     var saleTotal = sale.SaleItems.Aggregate(0m, (current, item) => current + item.SellingPrice);
     saleTotal = saleTotal + saleTotal * .06m;
     sale.DateOfSale = DateTime.Now;
     sale.Total = saleTotal;
     return sale;
 }
Beispiel #2
0
 /// <summary>
 /// Method updates a sale that already exists in the database
 /// </summary>
 /// <param name="sale">Takes a single SaleDTO as an argument.</param>
 public void Update(SaleDTO sale)
 {
     _saleRepository.Update(sale);
 }
Beispiel #3
0
 /// <summary>
 /// Method inserts a new sale into the database
 /// </summary>
 /// <param name="sale">Takes a single SaleDTO as an argument.</param>
 public void Insert(SaleDTO sale)
 {
     _saleRepository.Insert(sale);
 }