Exemplo n.º 1
0
 public ActionResult Create(FormCollection collection,EXTN_TBL extenTblModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.EXTN_TBL.Add(extenTblModel);
             db.SaveChanges();
             return RedirectToAction("Index", db.EXTN_TBL.ToList());
         }
     }
     catch
     {
         return View();
     }
 }
Exemplo n.º 2
0
        public ActionResult Edit(int id, FormCollection collection,EXTN_TBL extnTblModel)
        {
            try
            {
                extnTblModel.EXTN_ID = id;
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var entry = db.Entry<EXTN_TBL>(extnTblModel);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.EXTN_TBL.Attach(extnTblModel);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index", db.EXTN_TBL.ToList());
                }


            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 3
0
 public ActionResult Delete(int id, FormCollection collection,EXTN_TBL extnTblModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             extnTblModel = db.EXTN_TBL.FirstOrDefault(p => p.EXTN_ID == id);
             var entry = db.Entry<EXTN_TBL>(extnTblModel);
             entry.State = EntityState.Deleted;
             db.EXTN_TBL.ToList().RemoveAll(p => p.EXTN_ID == extnTblModel.EXTN_ID);
             db.SaveChanges();
             return RedirectToAction("Index", db.EXTN_TBL.ToList());
         }
     }
     catch
     {
         return View();
     }
 }