public async Task <IActionResult> PutTholiday(long id, Tholiday tholiday) { if (id != tholiday.TholidayId) { return(BadRequest()); } _context.Entry(tholiday).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TholidayExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tholiday> > PostTholiday(Tholiday tholiday) { _context.Tholiday.Add(tholiday); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TholidayExists(tholiday.TholidayId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTholiday", new { id = tholiday.TholidayId }, tholiday)); }