Exemple #1
0
        // 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"));
        }
Exemple #2
0
 public ActionResult Create([Bind(Exclude = "id")] TableComplaint complaint)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     obj.TableComplaints.Add(complaint);
     obj.SaveChanges();
     return(View());
 }
Exemple #3
0
        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"));
        }