public async Task <IActionResult> Edit(int id, [Bind("UserID,FirstName,LastName,Age,Address,Zip,City")] User user) { if (id != user.UserID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("FoodID,Title,Content,Picture,Price,Location,CategoryID,UserID")] Food food) { if (id != food.FoodID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(food); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FoodExists(food.FoodID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Categories, "CategoryID", "Title", food.CategoryID); ViewData["UserID"] = new SelectList(_context.Users, "UserID", "FirstName", food.UserID); return(View(food)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryID,Title")] Category category) { if (id != category.CategoryID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("TagID,Name,Color")] Tag tag) { if (id != tag.TagID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TagExists(tag.TagID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tag)); }
public async Task <IActionResult> UpdateShow(int id, [Bind("Title,AvailableTickets,Price,Date,ImageUrl,GenreId,AdminId")] Show show) { show.ShowId = id; db.Update(show); await db.SaveChangesAsync(); ICollection <Show> shows = db.Shows.ToList(); return(View("Shows", shows)); }