public IActionResult Edit(RoomViewModel roomViewModel) { var roomDomain = mapper.Map <Room>(roomViewModel); roomApp.Update(roomDomain); return(RedirectToAction("Index")); }
public ActionResult Edit(RoomViewModel roomViewModel) { if (ModelState.IsValid) { var roomRet = _roomAppService.Update(roomViewModel); if (roomRet.ValidationResult.IsValid) { return(RedirectToAction("Index")); } AddErrorIntoModelState(roomRet.ValidationResult); } return(View(roomViewModel)); }
public async Task <IActionResult> OnPostAsync(int id) { Id = id; ErrorMessage = ""; if (!ModelState.IsValid) { return(Page()); } var result = await _roomAppService.Update(id, Room); if (!result.IsSuccess) { ErrorMessage = result.Message; return(Page()); } else { return(RedirectToPage("/Map/Index")); } }