public static EmployeeSelfViewModel ToSelfViewModle(EmployeeSelfSaveResponse responce)
 {
     return(new EmployeeSelfViewModel()
     {
         Id = responce.EmployeeID,
         FirstName = responce.FirstName,
         LastName = responce.LastName,
         Email = responce.Email,
         Sex = responce.Sex,
     });
 }
Example #2
0
        public async Task <IActionResult> Self(string id, EmployeeSelfViewModel selfViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(selfViewModel));
            }

            var request = new EmployeeSelfSaveRequest(
                employeeId: selfViewModel.Id,
                firstName: selfViewModel.FirstName,
                lastName: selfViewModel.LastName,
                sex: selfViewModel.Sex,
                birthday: selfViewModel.Birthday,
                email: selfViewModel.Email
                );

            EmployeeSelfSaveResponse reponse = await _EmployeeSelfSaveService.HandleAsync(request);

            return(RedirectToAction(nameof(Self), new { id = selfViewModel.Id }));
        }