public IHttpActionResult PutSewadar(int id, Sewadar sewadar) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sewadar.ID) { return(BadRequest()); } db.Entry(sewadar).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SewadarExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Delete(int id) { Sewadar sewadar = db.Sewadar.Find(id); db.Sewadar.Remove(sewadar); Save(); }
public IHttpActionResult GetSewadar(int id) { Sewadar sewadar = db.Sewadars.Find(id); if (sewadar == null) { return(NotFound()); } return(Ok(sewadar)); }
public IHttpActionResult PostSewadar(Sewadar sewadar) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Sewadars.Add(sewadar); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = sewadar.ID }, sewadar)); }
public IHttpActionResult DeleteSewadar(int id) { Sewadar sewadar = db.Sewadars.Find(id); if (sewadar == null) { return(NotFound()); } db.Sewadars.Remove(sewadar); db.SaveChanges(); return(Ok(sewadar)); }
public void Update(Sewadar obj) { db.Entry(obj).State = EntityState.Modified; Save(); }
public void Insert(Sewadar obj) { db.Sewadar.Add(obj); Save(); }