public async Task <IActionResult> PostVoyageSlotToken([FromBody] VoyageSlotToken voyageSlotToken) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.VoyageSlotToken.Add(voyageSlotToken); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (VoyageSlotTokenExists(voyageSlotToken.VoyageSlotTokenId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetVoyageSlotToken", new { id = voyageSlotToken.VoyageSlotTokenId }, voyageSlotToken)); }
public async Task <IActionResult> PutVoyageSlotToken([FromRoute] long id, [FromBody] VoyageSlotToken voyageSlotToken) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != voyageSlotToken.VoyageSlotTokenId) { return(BadRequest()); } _context.Entry(voyageSlotToken).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoyageSlotTokenExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }