public string Put(int id, [FromBody] Enquiry obj) { // Update changes into database. using (CineplexDatabaseContext db = new CineplexDatabaseContext()) { db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); return("Enquiry updated successfully!"); } }
public string Delete(int id) { // Delete selected row in the database. using (CineplexDatabaseContext db = new CineplexDatabaseContext()) { var obj = db.Enquiries.Where( i => i.EnquiryID == id).SingleOrDefault(); db.Enquiries.Remove(obj); db.SaveChanges(); return("Enquiry deleted successfully!"); } }