public async Task <ActionResult <TimesheetDetail> > PostTimesheetDetail(TimesheetDetail timesheetDetail) { _context.TimesheetDetails.Add(timesheetDetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTimesheetDetail", new { id = timesheetDetail.Id }, timesheetDetail)); }
public async Task <IActionResult> PutTimesheetDetail(int id, TimesheetDetail timesheetDetail) { if (id != timesheetDetail.Id) { return(BadRequest()); } _context.Entry(timesheetDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimesheetDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }