public IHttpActionResult PutView_Customer_Ledger(int id, View_Customer_Ledger view_Customer_Ledger) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != view_Customer_Ledger.Id) { return BadRequest(); } db.Entry(view_Customer_Ledger).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!View_Customer_LedgerExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostView_Customer_Ledger(View_Customer_Ledger view_Customer_Ledger) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.View_Customer_Ledger.Add(view_Customer_Ledger); try { db.SaveChanges(); } catch (DbUpdateException) { if (View_Customer_LedgerExists(view_Customer_Ledger.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = view_Customer_Ledger.Id }, view_Customer_Ledger); }