Example #1
0
 public ReceiptViewModel(Receipt rec)
 {
     Id = rec.Id.ToString("D6"); 
     Adress = rec.Order.AdresShipping.FullAdress;
     Distance = rec.Order.Distance;
     PhoneNumber = rec.Order.User.PhoneNumber;
     ShippingCost = rec.ShippingCost;
     ReceiptStatus = rec.Status.ToString();
     ShippingType = rec.Order.ShippingType;
 }
Example #2
0
 public async Task CreateReceipt(Receipt rec)
 {
     _db.Entry(rec).State = EntityState.Added;
     await Save();
 }
Example #3
0
 public async Task<ActionResult> CreateReceipt(string id, string returnUrl)
 {
     var order = await OrderManager.FindAsync(id);
     var tariffModel = await GetTariffModel(order);
     var rec = new Receipt
     {
         Date = DateTime.Now,
         OrderId = order.Id,
         Order = order,
         ShippingCost = tariffModel.Tariff,
         Status = ReceiptStatus.Created
     };
     await CalculateProductCount(order.Id);
     if (!ModelState.IsValid)
         return RedirectToAction("Edit", order.Id);
     await OrderManager.CreateReceipt(rec);
     return RedirectToAction("DetailReceipt", new { id = rec.Id });
 }