public ActionResult AddEmployee() { var companies = GetCompaniesNames(); var employeeVM = new EmployeeVMAdd() { Companies = companies, Company = new CompanyVM() }; return(View("AddEmployee", employeeVM)); }
public RedirectToRouteResult AddEmployee(EmployeeVMAdd employeeVM) { var employeeDTO = new EmployeeDTO(); employeeDTO.Name = employeeVM.Name; employeeDTO.Surname = employeeVM.Surname; employeeDTO.Patronymic = employeeVM.Patronymic; employeeDTO.Position = employeeVM.Position; employeeDTO.EmploymentDate = employeeVM.EmploymentDate ?? DateTime.Now; employeeDTO.Company = new CompanyDTO() { CompanyName = employeeVM.Companies[0] }; _service.EmployeeService.Create(employeeDTO); return(RedirectToAction("Index")); }