Esempio n. 1
0
 public ActionResult Edit(SetupRoomTypeModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             int i = pro.Update(model);
             if (i != 0)
             {
                 TempData["success"] = UtilityMessage.edit;
             }
             else
             {
                 TempData["success"] = UtilityMessage.editfailed;
             }
             return(RedirectToAction("Index"));
         }
         return(View());
     }
     catch
     {
         TempData["success"] = "Error occur";
         return(RedirectToAction("Index"));
     }
 }
Esempio n. 2
0
        //
        // GET: /SetupRoomType/

        public ActionResult Index()
        {
            SetupRoomTypeModel model = new SetupRoomTypeModel();

            model.SetupRoomTypeList = pro.GetList();
            return(View(model));
        }
Esempio n. 3
0
 public int Update(SetupRoomTypeModel model)
 {
     using (EHMSEntities ent = new EHMSEntities())
     {
         var item = ent.SetupRoomTypes.Where(x => x.RoomTypeName == model.RoomTypeName && x.RoomTypeId != model.RoomTypeId);
         if (item.Count() == 0)
         {
             var objToUpdate = ent.SetupRoomTypes.Where(x => x.RoomTypeId == model.RoomTypeId).FirstOrDefault();
             objToUpdate.DepartmentId = 555;
             AutoMapper.Mapper.Map(model, objToUpdate);
             ent.Entry(objToUpdate).State = System.Data.EntityState.Modified;
             int i = ent.SaveChanges();
             return(i);
         }
         else
         {
             return(0);
         }
     }
 }
Esempio n. 4
0
        public int Insert(SetupRoomTypeModel model)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                var item = ent.SetupRoomTypes.Where(x => x.RoomTypeName.ToLower() == model.RoomTypeName.ToLower());

                if (item.Count() == 0)
                {
                    var objToSave = AutoMapper.Mapper.Map <SetupRoomTypeModel, SetupRoomType>(model);
                    objToSave.DepartmentId = 555;
                    ent.SetupRoomTypes.Add(objToSave);
                    int i = ent.SaveChanges();
                    return(i);
                }
                else
                {
                    return(0);
                }
            }
        }
Esempio n. 5
0
        //Get: /SetupRoomType/Edit
        public ActionResult Edit(int id)
        {
            SetupRoomTypeModel model = pro.GetList().Where(x => x.RoomTypeId == id).FirstOrDefault();

            return(View(model));
        }