public async Task <CommandExecutionResult> HandleAsync(AddEmployeeImCommand command) { var phoneEntity = command.Adapt <ImEntity>(); await _repository.InsertAsync(phoneEntity); return(CommandExecutionResult.Success); }
public async Task <IActionResult> AddIm(AddEmployeeImQuery query, AddEmployeeImCommand command) { if (ModelState.IsValid == false) { var queryExecutionResult = await _employeeService.HandleAsync(query); var vm = BuildNewImVm(queryExecutionResult.Result, command); return(View(vm)); } await _employeeService.HandleAsync(command); return(Redirect(ImsUri(new SearchEmployeeImQuery(query.EmployeeId)))); }
private IPageVm BuildNewImVm(EmployeeEntity employeeEntity, AddEmployeeImCommand command) => BuildImTab(employeeEntity).Link(RelTypes.Breadcrumb, "New Email", AddImUri(new AddEmployeeImQuery(employeeEntity.EmployeeId))) .Property(nameof(AddEmployeeImCommand.Im), "IM", command.Im) .Property(nameof(AddEmployeeImCommand.Description), "Description", command.Description) .Build() .ToFormVm();