public IHttpActionResult PutAadharMaster(int id, AadharMaster aadharMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aadharMaster.id) { return(BadRequest()); } db.Entry(aadharMaster).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AadharMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetAadharMaster(int id) { AadharMaster aadharMaster = db.AadharMasters.Find(id); if (aadharMaster == null) { return(NotFound()); } return(Ok(aadharMaster)); }
public IHttpActionResult PostAadharMaster(AadharMaster aadharMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AadharMasters.Add(aadharMaster); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = aadharMaster.id }, aadharMaster)); }
public IHttpActionResult DeleteAadharMaster(int id) { AadharMaster aadharMaster = db.AadharMasters.Find(id); if (aadharMaster == null) { return(NotFound()); } db.AadharMasters.Remove(aadharMaster); db.SaveChanges(); return(Ok(aadharMaster)); }