Exemple #1
0
 public ActionResult Edit(string id, tbl_MCAT tbl_MCAT)
 {
     try
     {
         if (id == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         }
         // TODO: Add update logic here
         using (WebAppDbContext db = new WebAppDbContext())
         {
             if (!ModelState.IsValid)
             {
                 return PartialView("_Edit");
             }
             db.Entry(tbl_MCAT).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         Alert("Record Updated Sucessfully!!!", NotificationType.success);
         return RedirectToAction("Index");
     }
     catch
     {
         Alert("Their is something went wrong!!!", NotificationType.error);
         return RedirectToAction("Index");
     }
 }
Exemple #2
0
 public ActionResult Create(tbl_MCAT tbl_MCAT)
 {
     try
     {
         // TODO: Add insert logic here
         using (WebAppDbContext db = new WebAppDbContext())
         {
             if (!ModelState.IsValid)
             {
                 return PartialView("_Create");
             }
             db.tbl_MCAT.Add(tbl_MCAT);
             db.SaveChanges();
         }
         Alert("Data Saved Sucessfully!!!", NotificationType.success);
         return RedirectToAction("Index");
     }
     catch
     {
         Alert("Their is something went wrong!!!", NotificationType.error);
         return RedirectToAction("Index");
     }
 }
Exemple #3
0
 public ActionResult Delete(string id, tbl_MCAT tbl_MCAT)
 {
     try
     {
         if (id == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         }
         // TODO: Add delete logic here
         using (WebAppDbContext db = new WebAppDbContext())
         {
             var abc = db.tbl_MCAT.Where(x => x.MCAT_ID == id).FirstOrDefault();
             db.tbl_MCAT.Remove(abc);
             db.SaveChanges();
         }
         Alert("Record Deleted Sucessfully!!!", NotificationType.success);
         return RedirectToAction("Index");
     }
     catch
     {
         Alert("Their is something went wrong!!!", NotificationType.error);
         return RedirectToAction("Index");
     }
 }