public async Task <IActionResult> PutTbooking(long id, Tbooking tbooking) { if (id != tbooking.TbookingId) { return(BadRequest()); } _context.Entry(tbooking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbookingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tbooking> > PostTbooking(Tbooking tbooking) { _context.Tbooking.Add(tbooking); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TbookingExists(tbooking.TbookingId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTbooking", new { id = tbooking.TbookingId }, tbooking)); }