示例#1
0
        public ActionResult Index()
        {
            SetupUnitModel model = new SetupUnitModel();

            model.UnitLists = pro.GetList();
            return(View(model));
        }
示例#2
0
        public ActionResult Edit(int id)
        {
            SetupUnitModel model = new SetupUnitModel();

            model = pro.GetList().Where(x => x.UnitId == id).FirstOrDefault();

            return(View(model));
        }
示例#3
0
 public int Insert(SetupUnitModel model)
 {
     using (EHMSEntities ent = new EHMSEntities())
     {
         var objToSave = AutoMapper.Mapper.Map <SetupUnitModel, SetupUnit>(model);
         objToSave.Status = 1;
         ent.SetupUnits.Add(objToSave);
         ent.SaveChanges();
     }
     return(1);
 }
示例#4
0
        public int Update(SetupUnitModel model)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToEdit = ent.SetupUnits.Where(x => x.UnitId == model.UnitId).FirstOrDefault();

                AutoMapper.Mapper.Map(model, objToEdit);

                ent.Entry(objToEdit).State = System.Data.EntityState.Modified;
                ent.SaveChanges();
            }
            return(1);
        }
示例#5
0
 public ActionResult Edit(int id, SetupUnitModel model)
 {
     if (ModelState.IsValid)
     {
         int i = pro.Update(model);
         if (i == 1)
         {
             TempData["success"] = "Record Updated Successfully !";
         }
         else
         {
             TempData["success"] = "Record Updation Failed !";
         }
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
示例#6
0
        public ActionResult Create()
        {
            SetupUnitModel model = new SetupUnitModel();

            return(View(model));
        }