public async Task <IActionResult> PutBarcoModel(string id, BarcoModel barcoModel) { if (id != barcoModel.boatID) { return(BadRequest()); } _context.Entry(barcoModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BarcoModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <BarcoModel> > PostBarcoModel(BarcoModel barcoModel) { _context.BarcoModels.Add(barcoModel); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (BarcoModelExists(barcoModel.boatID)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetBarcoModel", new { id = barcoModel.boatID }, barcoModel)); }