public RedirectToRouteResult RemoveCart(CollectionCart selectItems, int productId, string returnUrl) { Product selectProduct = repository.Products.FirstOrDefault(x => x.ProductId == productId); if (selectProduct != null) { selectItems.RemoveLine(selectProduct); } return RedirectToAction("Index", new { returnUrl }); }
public RedirectToRouteResult AddToCart(CollectionCart selectItems,int productId, string returnUrl) { Product selectProduct = repository.Products.FirstOrDefault(x => x.ProductId == productId); CollectionCart workByCart = new CollectionCart(); if (selectProduct != null) { selectItems.AddCart(selectProduct, 1); } return RedirectToAction("Index", new { returnUrl }); }
public object BindModel(ControllerContext modelControllerContext , ModelBindingContext bindingContext) { CollectionCart selectItems = (CollectionCart)modelControllerContext.HttpContext.Session[sessionKey]; if (selectItems == null) { selectItems = new CollectionCart(); modelControllerContext.HttpContext.Session[sessionKey] = selectItems; } return selectItems; }
public void ProcessEmail(CollectionCart cartCollection, ShippingDetails details) { EmailProc returnValue = new EmailProc(); StringBuilder builderCart = new StringBuilder(); foreach (var prod in cartCollection.GetLines()) { builderCart.AppendLine(@"<li style='list-style-position:inside;list-style-type:square; margin-left:50px; '>"); builderCart.AppendLine(prod.Product.Name + " " + prod.Product.Price); builderCart.AppendLine("</li>"); } string full_Name = details.FirstName + "" + details.LastName; string emailText=String.Format(Resources.Domain.Resources.EmailText, full_Name, builderCart.ToString(),cartCollection.TotalPrice(), details.Country, details.City, details.House, details.Telephone); returnValue.EmailText = emailText; returnValue.EmailAdd = details.EMail; SendEmail(returnValue); }
public ActionResult Summary(CollectionCart selectItems) { return View(selectItems); }
public ActionResult Index(CollectionCart selectItems, string returnUrl) { return View(new CartModelView { Cart = selectItems, RedirectUrl = returnUrl }); }
public ActionResult Checkout(CollectionCart cartCollection, ShippingDetails datails) { opderProc.ProcessEmail(cartCollection, datails); cartCollection.Clear(); return View("Completed"); }
public ActionResult Checkout(CollectionCart selectItems) { return View(new ViewShippingDetails()); }