public async Task <IActionResult> Edit(int id, [Bind("ID,CNP")] UnwantedUser unwantedUser) { if (id != unwantedUser.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(unwantedUser); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UnwantedUserExists(unwantedUser.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(unwantedUser)); }
public T Update(T itemToUpdate) { var entity = dbContext.Update <T>(itemToUpdate); dbContext.SaveChanges(); return(entity.Entity); }
public async Task <IActionResult> Edit(int id, [Bind("ID,RegistrationNumber,Km,ManufacutreDate,Status,Brand,Model,Class,Price")] Car car) { if (id != car.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(car); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarExists(car.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(car)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,User,Car,Start,End")] History history) { if (id != history.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(history); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistoryExists(history.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(history)); }