public async Task <ActionResult> Update(int id) { GetDepartmentByIdDto departmentByIdDto = await Mediator.Send(new GetDepartmentByIdQuery { Id = id }); return(View(departmentByIdDto)); }
public async Task <ActionResult> Update(GetDepartmentByIdDto dto) { if (ModelState.IsValid) { int result = await Mediator.Send(new UpdateDepartmentCommand { Id = dto.Id, Name = dto.Name, Code = dto.Code, Email = dto.Email }); if (result > 0) { return(View("List")); } else { ModelState.AddModelError("", "Update User thất bại"); } } return(View(dto)); }