public async Task <IActionResult> PutDateYearoff(int id, DateYearoff dateYearoff) { if (id != dateYearoff.DateId) { return(BadRequest()); } _context.Entry(dateYearoff).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DateYearoffExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DateYearoff> > PostDateYearoff(DateYearoff dateYearoff) { _context.DateYearoff.Add(dateYearoff); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (DateYearoffExists(dateYearoff.DateId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetDateYearoff", new { id = dateYearoff.DateId }, dateYearoff)); }