public ActionResult Edit(GameComment gameComment, int id) { if (ModelState.IsValid) { db.Entry(gameComment).State = EntityState.Modified; UpdateRating(gameComment.GameId); db.SaveChanges(); return(RedirectToAction("Details", "Games", new { id = gameComment.GameId })); } return(View(gameComment)); }
public ActionResult Edit([Bind(Include = "Id,Name")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(category); }
public ActionResult Edit(NewsFeed newsFeed) // было Edit([Bind(Include = "Id,Name")] NewsFeed newsFeed) { if (ModelState.IsValid) { db.Entry(newsFeed).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(newsFeed)); }
public ActionResult Edit([Bind(Include = "ID_Type,TypeID_name,TypeID_Description,ID_Number")] TypeID typeID) { if (ModelState.IsValid) { db.Entry(typeID).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(typeID)); }
public ActionResult Edit([Bind(Include = "Product_ID,Product_Name,Product_Description,Product_Quantity")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Edit([Bind(Include = "ID,Category,Cost,IconURL,Name")] Item item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Edit([Bind(Include = "Client_ID,Client_Name,Client_Apellido,ID_Type,ID_Number")] Client client) { if (ModelState.IsValid) { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_Type = new SelectList(db.TypeIDs, "ID_Type", "TypeID_name", client.ID_Type); return(View(client)); }
public ActionResult Edit(News news) // было Edit([Bind(Include = "Id,NewsHeader,NewsBody,CreateDate,ModifyDate,NewsFeedId")] News news) { news.ModifyDate = DateTime.Now; // после редактирования сохраняем дату модификации if (ModelState.IsValid) { db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.NewsFeedId = new SelectList(db.NewsFeeds, "Id", "Name", news.NewsFeedId); return(View(news)); }
public ActionResult Edit(Customer customer) { if (User.Identity.IsAuthenticated == false) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Profile")); } return(View(customer)); }
public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { if (customer.RoleId > 3 | customer.RoleId < 1) { ViewData["RoleIdError"] = "Неверный RoleId"; return(View()); } db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit(Game game, HttpPostedFileBase gamePoster) { if (ModelState.IsValid) { if (gamePoster != null && gamePoster.ContentLength > 0) { string path = Server.MapPath("~/images/games/"); string pic = Path.GetFileName(gamePoster.FileName); gamePoster.SaveAs(Path.Combine(path, pic)); game.GamePosterUrl = Path.Combine("/images/games/", pic); } db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", game.CategoryId); return(View(game)); }