public ActionResult Edit([Bind(Include = "PhoneNumber,FistName,LastName,Address")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PhoneNumber = new SelectList(db.CreditCards, "Id", "CardName", customer.PhoneNumber); return(View(customer)); }
public ActionResult Edit(News news) { news.AccountUsername = User.Identity.Name; if (ModelState.IsValid) { db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.NewsGroup_id = new SelectList(db.NewsGroupSet, "id", "Name", news.NewsGroup_id); ViewBag.AccountUsername = new SelectList(db.AccountSet, "Username", "FirstName", news.AccountUsername); return(View(news)); }
public ActionResult Edit(NewsGroup newsgroup) { if (ModelState.IsValid) { db.Entry(newsgroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } if (Request.IsAjaxRequest()) { return(PartialView(newsgroup)); } return(View(newsgroup)); }
public ActionResult UserProfile(Account account) { account.Username = User.Identity.Name; if (ModelState.IsValid) { db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Account")); } if (Request.IsAjaxRequest()) { return(PartialView(account)); } return(View(account)); }
public ActionResult Edit(Comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.ProductSet, "Id", "Title", comment.ProductId); if (Request.IsAjaxRequest()) { return(PartialView(comment)); } return(View(comment)); }
public ActionResult Edit(ProductGroup productgroup) { productgroup.AccountUsername = User.Identity.Name; if (ModelState.IsValid) { db.Entry(productgroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountUsername = new SelectList(db.AccountSet, "Username", "FirstName", productgroup.AccountUsername); if (Request.IsAjaxRequest()) { return(PartialView(productgroup)); } return(View(productgroup)); }
public ActionResult Edit(Product product) { product.Date = DateTime.Now.Year.ToString() + " " + DateTime.Now.Month.ToString() + " " + DateTime.Now.Day.ToString() + " - " + DateTime.Now.ToShortTimeString(); product.AccountUsername = User.Identity.Name; if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountUsername = new SelectList(db.AccountSet, "Username", "FirstName", product.AccountUsername); ViewBag.ProductGroupId = new SelectList(db.ProductGroupSet, "Id", "Name", product.ProductGroupId); if (Request.IsAjaxRequest()) { return(PartialView(product)); } return(View(product)); }
public ActionResult UserProfile(Users users) { if (Session["username"] == null) { return(HttpNotFound()); } if (ModelState.IsValid) { db.Entry(users).State = EntityState.Modified; db.SaveChanges(); Session["fullname"] = users.FirstName + " " + users.LastName; return(RedirectToAction("Index")); } if (Request.IsAjaxRequest()) { return(PartialView(users)); } return(View(users)); }