Ejemplo n.º 1
0
        public ActionResult Index()
        {
            SetUpSectionModel model = new SetUpSectionModel();

            model.SetUpSectionbModelList = SectionProvider.GetList();
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            SetUpSectionModel model = new SetUpSectionModel();

            model = SectionProvider.GetList().Where(x => x.SectionId == id).FirstOrDefault();

            return(View(model));
        }
Ejemplo n.º 3
0
 public void Details(int id)
 {
     using (EHMSEntities ent = new EHMSEntities())
     {
         var config = new MapperConfiguration(cfg => {
             cfg.CreateMap <SetupSection, SetUpSectionModel>();
         });
         //AutoMapper.Mapper.CreateMap<SetupSections, SetUpSectionModel>();
         var Details           = ent.SetupSections.Where(x => x.SectionId == id).FirstOrDefault();
         SetUpSectionModel det = AutoMapper.Mapper.Map <SetupSection, SetUpSectionModel>(Details);
     }
 }
Ejemplo n.º 4
0
        public int Update(SetUpSectionModel model)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToEdit = ent.SetupSections.Where(x => x.SectionId == model.SectionId).FirstOrDefault();

                AutoMapper.Mapper.Map(model, objToEdit);

                ent.Entry(objToEdit).State = System.Data.EntityState.Modified;
                ent.SaveChanges();
            }
            return(1);
        }
Ejemplo n.º 5
0
        public int Insert(SetUpSectionModel model)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToSave = AutoMapper.Mapper.Map <SetUpSectionModel, SetupSection>(model);
                objToSave.CreatedBy   = 1;
                objToSave.CreatedDate = DateTime.Now;
                objToSave.Status      = 1;
                ent.SetupSections.Add(objToSave);

                ent.SaveChanges();
            }
            return(1);
        }
Ejemplo n.º 6
0
 public ActionResult Edit(int id, SetUpSectionModel model)
 {
     if (ModelState.IsValid)
     {
         int i = SectionProvider.Update(model);
         if (i == 1)
         {
             TempData["success"] = "Record Updated Successfully !";
         }
         else
         {
             TempData["success"] = "Record Updation Failed !";
         }
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Ejemplo n.º 7
0
        public ActionResult Create()
        {
            SetUpSectionModel model = new SetUpSectionModel();

            return(View(model));
        }