public async Task <IActionResult> PutTaxleWeight(long id, TaxleWeight taxleWeight) { if (id != taxleWeight.TaxleWeightId) { return(BadRequest()); } _context.Entry(taxleWeight).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaxleWeightExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TaxleWeight> > PostTaxleWeight(TaxleWeight taxleWeight) { _context.TaxleWeight.Add(taxleWeight); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TaxleWeightExists(taxleWeight.TaxleWeightId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTaxleWeight", new { id = taxleWeight.TaxleWeightId }, taxleWeight)); }