public async Task <IActionResult> CreateEmployeeDepartmentHistory([FromBody] HumanResources.EmployeeDepartmentHistory value) { _db.HumanResources_EmployeeDepartmentHistory.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditEmployeeDepartmentHistory(int businessEntityID, short departmentID, byte shiftID, DateTime startDate, [FromBody] HumanResources.EmployeeDepartmentHistory value) { var existing = await _db.HumanResources_EmployeeDepartmentHistory.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID && x.DepartmentID == departmentID && x.ShiftID == shiftID && x.StartDate == startDate); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.DepartmentID = value.DepartmentID; existing.ShiftID = value.ShiftID; existing.StartDate = value.StartDate; existing.EndDate = value.EndDate; existing.ModifiedDate = value.ModifiedDate; _db.HumanResources_EmployeeDepartmentHistory.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }