// GET: Admin/Employee/Update public ActionResult Update(int employeeId) { var model = new EmployeeUpdateVM { Employees = _employeeService.GetById(employeeId), Departmans = _departmanService.GetAll() }; return(View(model)); }
public ActionResult Update(int id, [FromBody] EmployeeUpdateVM x) { Employee employee = _dbContext.Employees.Find(id); if (employee == null) { return(BadRequest("pogresan ID")); } employee.employee_name = x.employee_name.RemoveTags(); employee.employee_age = x.employee_age; employee.employee_salary = x.employee_salary; _dbContext.SaveChanges(); return(Ok(employee)); }