public IActionResult GetLabourerAttendanceRating([FromBody] LabourerAttendance la) { var labourerAttendances = _context.LabourerAttendance.Where(l => l.LabourerId == la.LabourerId && l.JobId == la.JobId && l.DailyQualityRating != null); if (labourerAttendances != null) { return(new ObjectResult(labourerAttendances)); } else { return(NotFound()); } }
public async Task <IActionResult> PutLabourerAttendanceRating([FromBody] LabourerAttendance la) { var labourerAttendance = _context.LabourerAttendance.SingleOrDefault(l => l.LabourerId == la.LabourerId && l.JobId == la.JobId && l.Date == la.Date); if (labourerAttendance == null) { _context.LabourerAttendance.Add(la); } else { labourerAttendance.DailyQualityRating = la.DailyQualityRating; } await _context.SaveChangesAsync(); return(new ObjectResult(la)); }