public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,MusicType")] BALIBAR.Models.Type @type) { if (id != @type.Id) { return(new NotFoundViewResult("NotFoundError", "Type wasn't found")); } if (ModelState.IsValid) { try { _context.Update(@type); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeExists(@type.Id)) { return(new NotFoundViewResult("NotFoundError", "Type wasn't found")); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@type)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DateTime,AttendeesNum,BarID")] Reservation reservation) { if (id != reservation.Id) { return(new NotFoundViewResult("NotFoundError", "Reservation wasn't found")); } if (ModelState.IsValid) { try { reservation.Customer = await _userManager.GetUserAsync(HttpContext.User); _context.Update(reservation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReservationExists(reservation.Id)) { return(new NotFoundViewResult("NotFoundError", "Reservation wasn't found")); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(reservation)); }