// GET: Complaint/Delete/5 public ActionResult Delete(TableComplaint complaint) { var d = obj.TableComplaints.Where(x => x.id == complaint.id).FirstOrDefault(); obj.TableComplaints.Remove(d); obj.SaveChanges(); return(RedirectToAction("ComplaintList")); }
public ActionResult Create([Bind(Exclude = "id")] TableComplaint complaint) { if (!ModelState.IsValid) { return(View()); } obj.TableComplaints.Add(complaint); obj.SaveChanges(); return(View()); }
public ActionResult Edit(TableComplaint complaint) { var orignalRecord = (from m in obj.TableComplaints where m.id == complaint.id select m).First(); if (!ModelState.IsValid) { return(View(orignalRecord)); } obj.Entry(orignalRecord).CurrentValues.SetValues(complaint); obj.SaveChanges(); return(RedirectToAction("ComplaintList")); }