예제 #1
0
        public async Task <CommandExecutionResult> HandleAsync(AddEmployeeImCommand command)
        {
            var phoneEntity = command.Adapt <ImEntity>();

            await _repository.InsertAsync(phoneEntity);

            return(CommandExecutionResult.Success);
        }
예제 #2
0
        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))));
        }
예제 #3
0
 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();