public ActionResult Edit([Bind(Include = "CustomerId,FirstName,LastName,UserName,PassWord,Email,Phone,Address")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "BasketId,ProductId,CustomerId,Quantity,SaveDate,Status")] Basket basket) { if (ModelState.IsValid) { db.Entry(basket).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customer, "CustomerId", "FirstName", basket.CustomerId); ViewBag.ProductId = new SelectList(db.Product, "ProductId", "ProductName", basket.ProductId); return(View(basket)); }
public bool Delete(Guid id) { var db = new ClockStoreContext(); var file = new ClockStoreContext().File.Find(id); db.Entry(file).State = EntityState.Deleted; db.File.Remove(file); return(db.SaveChanges() > 0); }
public ActionResult Edit([Bind(Include = "Id,Value,ProductId,Enable,Name")] Color color) { if (ModelState.IsValid) { db.Entry(color).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(color)); }
public ActionResult Edit(OfferCard offerCard) { if (ModelState.IsValid) { db.Entry(offerCard).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(offerCard)); }
public ActionResult Edit([Bind(Include = "NewsId,Title,Content,ImageId,VideoId,LangId")] News news) { if (ModelState.IsValid) { db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(news)); }
public ActionResult Edit(Advertise advertise, HttpPostedFileBase file) { if (ModelState.IsValid) { db.Entry(advertise).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FileId = new SelectList(db.File, "FileId", "ContextType", advertise.FileId); return(View(advertise)); }
public ActionResult Edit([Bind(Include = "ExtraImagesId,FileId,ProductId")] ExtraImages extraImages) { if (ModelState.IsValid) { db.Entry(extraImages).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.Product, "ProductId", "ProductName", extraImages.ProductId); return(View(extraImages)); }
public static void ClearBasket(Guid customerId) { var db = new ClockStoreContext(); var list = db.Basket.ToList().Where(c => c.CustomerId == customerId && c.IsArchive == false); if (list != null) { foreach (var item in list) { if (item.Product.IsBlocked.HasValue && item.Product.IsBlocked.Value) { item.Product.IsBlocked = false; db.Entry(item.Product).State = EntityState.Modified; db.SaveChanges(); } db.Basket.Remove(item); db.SaveChanges(); } } }
public virtual bool Update(TDBModel obj) { this.CheckConstraint(obj); db.Entry(obj).State = EntityState.Modified; return(db.SaveChanges() > 0); }
public ActionResult Verify(Guid cusId, Guid orderid) { Order order = db.Order.Find(orderid); if (Request.QueryString["Status"] != "" && Request.QueryString["Status"] != null && Request.QueryString["Authority"] != "" && Request.QueryString["Authority"] != null) { if (Request.QueryString["Status"].ToString().Equals("OK")) { int Amount = Convert.ToInt32(order.CurrentPrice); System.Net.ServicePointManager.Expect100Continue = false; ZarinPal.PaymentGatewayImplementationServicePortTypeClient zp = new ZarinPal.PaymentGatewayImplementationServicePortTypeClient(); int Status = zp.PaymentVerification("a3078700-d5bd-11e8-81b7-005056a205be", Request.QueryString["Authority"].ToString(), Amount, out long RefID); if (Status == 100) { order.IsFinaly = true; db.SaveChanges(); ViewBag.IsSuccess = true; ViewBag.RefId = RefID; List <Basket> baskets = db.Basket.Where(c => c.CustomerId == SessionParameters.Customer.CustomerId && c.IsArchive == false).ToList(); ViewBag.Status = "پرداخت شما با موفقیت انجام شد"; var customerOffer = new CustomerOffer() { CustomerId = cusId, OfferCardId = order.OfferCardId }; db.CustomerOffers.Add(customerOffer); db.SaveChanges(); foreach (Basket item in baskets) { BasketOrder basketOrder = new BasketOrder() { BasketId = item.BasketId, OrderId = orderid }; db.BasketOrder.Add(basketOrder); db.SaveChanges(); item.LangId = CultureInfo.CurrentCulture.Name; item.IsArchive = true; db.Entry(item).State = EntityState.Modified; db.SaveChanges(); Product product = item.Product; product.IsBlocked = false; product.Count--; db.Entry(product).State = EntityState.Modified; db.SaveChanges(); } } else { ViewBag.IsSuccess = false; ViewBag.Status = "خطا در انجام تراکنش"; } } else { return(Redirect("/Baskets/FinalApproval")); //Response.Write("Error! Authority: " + Request.QueryString["Authority"].ToString() + " Status: " + Request.QueryString["Status"].ToString()); } } else { Response.Write("Invalid Input"); } return(View()); }