示例#1
0
 public ActionResult Edit(int id, Models.InforMation info)
 {
     try
     {
         Models.InfoDBHandle idb = new Models.InfoDBHandle();
         idb.UpdateInformation(info);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#2
0
 // GET: InforMation/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         Models.InfoDBHandle sdb = new Models.InfoDBHandle();
         if (sdb.DeleteInformation(id))
         {
             ViewBag.AlertMsg = " Deleted Successfully";
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#3
0
        public ActionResult Create(Models.InforMation info)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Models.InfoDBHandle idb = new Models.InfoDBHandle();
                    idb.AddInformation(info);

                    return(RedirectToAction("Index"));
                }
                ViewBag.Message = " Details Added Successfully";
                return(View());
            }
            catch
            {
                return(View());
            }
        }
示例#4
0
 // GET: InforMation/Edit/5
 public ActionResult Edit(int id)
 {
     Models.InfoDBHandle idb = new Models.InfoDBHandle();
     return(View(idb.GetInformation().Find(info => info.Id == id)));
 }
示例#5
0
 // GET: InforMation
 public ActionResult Index()
 {
     Models.InfoDBHandle dbhandle = new Models.InfoDBHandle();
     ModelState.Clear();
     return(View(dbhandle.GetInformation()));
 }