public void Handle(ChangeEmployeeNameCommand command) { var employee = _repo.GetById<Employee>(command.EmployeeId); employee.ChangeName(command.Name); _repo.Save(employee); }
public void Handle(ChangeEmployeeNameCommand command) { var employee = _repo.GetById <Employee>(command.EmployeeId); employee.ChangeName(command.Name); _repo.Save(employee); }
public ActionResult ChangeEmployeeName(ChangeEmployeeNameCommand command) { try { _service.Handle(command); return Json(new { Succeeded = true }); } catch (Exception ex) { return Json( new { Succeeded = false, ErrorMessage = string.Format("Something went bad...oops: {0}", ex.Message) }); } }