public ActionResult FastOrder(FastOrderBm bm, int id) { if (!this.ModelState.IsValid) { return(this.View(id)); } this.service.FastOrder(bm, id); return(this.Redirect("/Checkout/Success")); }
public void FastOrder(FastOrderBm bm, int id) { Product product = this.Context.Products.Find(id); Order order = new Order { DataAdded = DateTime.Now, Adress = bm.Adress, Name = bm.Name, PhoneNumber = bm.PhoneNumber, SumTotal = product.Price }; order.Products.Add(product); this.Context.Orders.Add(order); this.Context.SaveChanges(); }