public async Task <IActionResult> PutPackageBreakdown([FromRoute] int id, [FromBody] PackageBreakdown packageBreakdown) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != packageBreakdown.Id) { return(BadRequest()); } _context.Entry(packageBreakdown).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PackageBreakdownExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPackageBreakdown([FromBody] PackageBreakdown packageBreakdown) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.PackageBreakdown.Add(packageBreakdown); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPackageBreakdown", new { id = packageBreakdown.Id }, packageBreakdown)); }