public IActionResult Delete(int id) { if (id <= 0) { return(BadRequest()); } Employee employee = _employeesDataService.GetById(id); return(View(new EmployeeViewModel() { Id = employee.Id, Name = employee.Name, Surename = employee.Surename, Patronymic = employee.Patronymic, Age = employee.Age, Gender = employee.Gender, Profession = _employeesDataService.GetProfessions().FirstOrDefault(p => p.Id == employee.ProfessionId), })); }
public IActionResult Details(int id) { Employee employee = _employeesDataService.GetById(id); if (employee is not null) { return(View(new EmployeeViewModel() { Id = employee.Id, Name = employee.Name, Surename = employee.Surename, Patronymic = employee.Patronymic, Age = employee.Age, Gender = employee.Gender, Profession = _employeesDataService.GetProfessions().FirstOrDefault(p => p.Id == employee.ProfessionId), })); } else { return(NotFound()); } }
public IEnumerable <Profession> GetProfessions() => _employeesData.GetProfessions();