public async Task <IActionResult> CreateDepartment([FromBody] HumanResources.Department value) { _db.HumanResources_Department.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditDepartment(short departmentID, [FromBody] HumanResources.Department value) { var existing = await _db.HumanResources_Department.FirstOrDefaultAsync(x => x.DepartmentID == departmentID); if (existing == null) { return(NotFound()); } existing.DepartmentID = value.DepartmentID; existing.Name = value.Name; existing.GroupName = value.GroupName; existing.ModifiedDate = value.ModifiedDate; _db.HumanResources_Department.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }