public IHttpActionResult PutDeliveryChallan(int id, DeliveryChallan deliveryChallan) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != deliveryChallan.Id) { return BadRequest(); } db.Entry(deliveryChallan).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DeliveryChallanExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostDeliveryChallan(DeliveryChallan deliveryChallan) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.DeliveryChallans.Add(deliveryChallan); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = deliveryChallan.Id }, deliveryChallan); }