public Department UpdateDepartment(Int64 id, Department department) // There is no Auto Mapping can be acception { _context.Entry(department).State = EntityState.Modified; try { _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(null); } else { throw; } } return(department); }
public Employee UpdateEmployee(Int64 id, Employee employee) { employee.DocProofLink = this.FileUpload(employee.DocProofLink); _context.Entry(employee).State = EntityState.Modified; try { _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(null); } else { throw; } } // return NoContent(); return(employee); }