public IActionResult Update(int id) { var dto = Db.Get <Party>(id); var model = new UpdatePartyViewModel { ID = dto.ID, Name = dto.Name, IsDeleted = dto.Deleted }; return(View(model)); }
public IActionResult Update(UpdatePartyViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var dto = Db.Get <Party>(model.ID); var updated = dto.WithUpdates(name: model.Name); Db.InsertOrUpdate(updated); UnitOfWork.CommitChanges(); return(RedirectToAction(nameof(Index))); }