Exemplo n.º 1
0
        public async Task <CommandExecutionResult> HandleAsync(UpdateEmployeeGeneralInfoCommand command)
        {
            var changeEntry = new ChangeEntry <EmployeeEntity>().Key(employee => employee.EmployeeId, command.EmployeeId)
                              .Property(employee => employee.FirstName, command.FirstName)
                              .Property(employee => employee.LastName, command.LastName)
                              .Property(employee => employee.EmployeeNo, command.EmployeeNo);

            await _repository.UpdateAsync(changeEntry.Entity, changeEntry.Properties);

            return(CommandExecutionResult.Success);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GeneralInfo(UpdateEmployeeGeneralInfoQuery query, UpdateEmployeeGeneralInfoCommand command)
        {
            if (ModelState.IsValid == false)
            {
                var employeeEntity = command.Adapt <EmployeeEntity>();
                var vm             = BuildGeneralInfoForm(employeeEntity);

                return(PartialView(vm));
            }

            await _employeeService.HandleAsync(command);

            return(RedirectToAction(nameof(Index), new SearchEmployeeQuery(command.EmployeeNo)));
        }