public void CanCreateDtoWithEntity()
        {
            Employee employee = new Employee("Steven", "Buchanan");

            EntityIdSetter.SetIdOf(employee, 5);

            EmployeeDto employeeDto = EmployeeDto.Create(employee);

            employeeDto.Id.ShouldEqual(5);
            employeeDto.FirstName.ShouldEqual("Steven");
            employeeDto.LastName.ShouldEqual("Buchanan");
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id)
        {
            var result = await Execute(async() => await _employeeService.GetEmployeeById(id));

            if (!result.Failed)
            {
                return(View(EmployeeDto.Create(result.Output)));
            }

            TempData["ErrorMessage"] = result.Message;

            return(RedirectToAction(nameof(Index)));
        }