// Форма добавления нового сотрудника public IActionResult Create() { var model = new CreateOrUpdateEmployeeModel { Employee = new EmployeeDto(), Departments = new SelectList(_departments.Departments, "Id", "Name"), Positions = new SelectList(_departments.Positions, "Id", "Name") }; return(PartialView(model)); }
public async Task <IActionResult> UpdateAsync(CreateOrUpdateEmployeeModel model) { if (ModelState.IsValid) { await _employees.UpdateEmployeeAsync(model.Employee); } model.Departments = new SelectList(_departments.Departments, "Id", "Name"); model.Positions = new SelectList(_departments.Positions, "Id", "Name"); return(PartialView("Update", model)); }
// Форма изменения данных сотрудника public async Task <IActionResult> UpdateAsync(int id) { var employee = await _employees.GetEmployeeByIdAsync(id); var model = new CreateOrUpdateEmployeeModel { Employee = employee, Departments = new SelectList(_departments.Departments, "Id", "Name"), Positions = new SelectList(_departments.Positions, "Id", "Name") }; return(PartialView(model)); }