public ActionResult Confirm(Order vm) { var order = Repository.GetOrder(_shopId); if (order == null) return RedirectToAction("index"); CloseOrder(order); SendEmail( Config.ShopEmailRecipient, String.Format(SitePhrases.LabelShopOrderEmailSubject, Config.Name), String.Format(SitePhrases.LabelShopOrderEmailBody, String.Format( "{0}: {1}<br/><br/>{2}<br/>{3}<br/>{4}<br/>{5}<br/>{6}<br/>{7}<br/><br/>{8}<br/>{9}: {10:f2}<br/>{11}: {12:f2}<br/>{13}: {14:f2}", Phrases.LabelOrderId, order.Id, order.Name, order.Address, order.Postcode, order.City, order.Phone, order.Email, String.Join("<br/>", order.OrderLines.Select(l => String.Format( "{0} : {1} : {2:f2}", l.Edition.Isbn, l.Edition.Name, l.Edition.Price )).ToArray()), Phrases.LabelOrderSubtotal, order.Subtotal, Phrases.LabelOrderDistributionCost, order.DistributionCost, Phrases.LabelOrderTotal, order.Subtotal + order.DistributionCost ) ) ); return RedirectToAction("receipt", new { id = order.ExternalId }); }
public ActionResult DeleteOrder(Order vm) { Repository.Delete(Repository.GetOrder(vm.Id)); Repository.Save(); return RedirectToAction("orders"); }
partial void DeleteOrder(Order instance);
partial void UpdateOrder(Order instance);
partial void InsertOrder(Order instance);
public void Delete(Order order) { _db.OrderLines.DeleteAllOnSubmit(order.OrderLines); _db.Orders.DeleteOnSubmit(order); }
public void Add(Order order) { _db.Orders.InsertOnSubmit(order); }
private void CloseOrder(Order order) { CalculateDistributionCost(order); order.ClosedAt = DateTime.Now; Repository.Save(); Response.Cookies[CookieName].Value = Guid.NewGuid().ToString(); }
private void CalculateDistributionCost(Order order) { if (order == null) return; order.DistributionCost = order.Subtotal >= Config.DistributionCostLimit ? 0 : Config.DistributionCostAmount; }