public async Task <IHttpActionResult> PutPriceListPart(int id, PriceListPart priceListPart) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != priceListPart.PriceListPartId) { return(BadRequest()); } db.Entry(priceListPart).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PriceListPartExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetPriceListPart(int id) { PriceListPart priceListPart = await db.PriceListParts.FindAsync(id); if (priceListPart == null) { return(NotFound()); } return(Ok(priceListPart)); }
public async Task <IHttpActionResult> PostPriceListPart(PriceListPart priceListPart) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PriceListParts.Add(priceListPart); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = priceListPart.PriceListPartId }, priceListPart)); }
public async Task <IHttpActionResult> DeletePriceListPart(int id) { PriceListPart priceListPart = await db.PriceListParts.FindAsync(id); if (priceListPart == null) { return(NotFound()); } db.PriceListParts.Remove(priceListPart); await db.SaveChangesAsync(); return(Ok(priceListPart)); }