public IHttpActionResult PutDeatails(int id, Deatails deatails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deatails.Id) { return(BadRequest()); } db.Entry(deatails).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DeatailsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDeatails(int id) { Deatails deatails = db.Deatails.Find(id); if (deatails == null) { return(NotFound()); } return(Ok(deatails)); }
public IHttpActionResult PostDeatails(Deatails deatails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Deatails.Add(deatails); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = deatails.Id }, deatails.Id)); }
public IHttpActionResult DeleteDeatails(int id) { Deatails deatails = db.Deatails.Find(id); if (deatails == null) { return(NotFound()); } db.Deatails.Remove(deatails); db.SaveChanges(); return(Ok(deatails)); }