public async Task <IActionResult> Edit(int id, [Bind("Id,Email,Name")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,RestaurantId,RatingValue, Comment")] Rating rating) { if (id != rating.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rating); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RatingExists(rating.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", rating.CustomerId); ViewData["RestaurantId"] = new SelectList(_context.Set <Restaurant>(), "Id", "RegistredName", rating.RestaurantId); return(View(rating)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RegistredName,Since,Address, Description")] Restaurant restaurant) { if (id != restaurant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(restaurant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RestaurantExists(restaurant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(restaurant)); }