예제 #1
0
 public ActionResult Edit(int id, VDCMUNModel model)
 {
     if (ModelState.IsValid)
     {
         if (pro.EditVdcMun(id, model))
         {
             TempData["Msg"] = "Data has been Updated succeessfully";
         }
         else
         {
             TempData["MsgError"] = "Data has Not been Updated succeessfully";
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #2
0
 public ActionResult Create(VDCMUNModel model)
 {
     if (ModelState.IsValid)
     {
         if (pro.InsertVdcMun(model))
         {
             TempData["Msg"] = "Data has been Saved succeessfully";
         }
         else
         {
             TempData["MsgError"] = "Data has Not been Saved succeessfully";
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #3
0
        public bool EditVdcMun(int id, VDCMUNModel model)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                var obj = ent.VDCMUNs.ToList().Where(x => x.VdcMunID == id).FirstOrDefault();
                obj.VdcMunNameEng = model.VdcMunNameEng;
                obj.DistrictID    = model.DistrictID;

                int i = ent.SaveChanges();
                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #4
0
 public bool InsertVdcMun(VDCMUNModel model)
 {
     using (EHMSEntities ent = new EHMSEntities())
     {
         var objInsertVdcMun = new VDCMUN()
         {
             VdcMunNameEng = model.VdcMunNameEng,
             DistrictID    = model.DistrictID
         };
         ent.VDCMUNs.Add(objInsertVdcMun);
         int i = ent.SaveChanges();
         if (i > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #5
0
 public ActionResult Edit(int id)
 {
     model = pro.PopulateRecords().Where(x => x.VdcMunID == id).FirstOrDefault();
     return(View(model));
 }