public bool AddSubMenu(SubMenuVM SubMenu)
 {
     try
     {
         if (HttpContext.Current.Session["User"] != null)
         {
             var        user = (LoginVM)HttpContext.Current.Session["User"];
             tblSubMenu sm   = new tblSubMenu();
             sm.ActionName     = SubMenu.ActionName;
             sm.ControllerName = SubMenu.ControllerName;
             sm.isActive       = SubMenu.isActive;
             sm.MenuId         = SubMenu.MenuId;
             sm.SubMenuName    = SubMenu.SubMenuName;
             sm.IconClass      = SubMenu.IconClass;
             sm.CreatedBy      = user.RoleId;
             sm.ModifiedBy     = user.RoleId;
             sm.CreatedDate    = System.DateTime.Now;
             sm.ModifiedDate   = System.DateTime.Now;
             _subMResp.Add(sm);
             _unitOfWork.Complete();
             return(true);
         }
         return(false);
     }
     catch (Exception e) { return(false); }
 }
예제 #2
0
 public ActionResult AddOrEditSubMenu(SubMenuVM _smVM)
 {
     ViewBag.mainMenuList = dropDown.DDLGetMainMenus();
     if (ModelState.IsValid)
     {
         if (_smVM.SubMenuId == 0)
         {
             bool status = _SMService.AddSubMenu(_smVM);
             if (status)
             {
                 return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, message = "Error" }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             bool status = _SMService.UpdateSubMenu(_smVM);
             if (status)
             {
                 return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, message = "Error" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     else
     {
         return(PartialView(_smVM));
     }
 }
예제 #3
0
        public ActionResult AddOrEditSubMenu(int id = 0)
        {
            SubMenuVM sm = new SubMenuVM();

            ViewBag.mainMenuList = dropDown.DDLGetMainMenus();
            if (id == 0)
            {
                return(PartialView(sm));
            }
            else
            {
                sm = _SMService.GetSubMenuById(id);
                return(PartialView(sm));
            }
        }
 public SubMenuVM GetSubMenuById(int id)
 {
     try
     {
         var       SubMenu = _subMResp.GetById(id);
         SubMenuVM smVM    = new SubMenuVM();
         if (SubMenu != null)
         {
             smVM.ActionName     = SubMenu.ActionName;
             smVM.ControllerName = SubMenu.ControllerName;
             smVM.isActive       = SubMenu.isActive;
             smVM.MenuId         = SubMenu.MenuId;
             smVM.SubMenuId      = SubMenu.SubMenuId;
             smVM.SubMenuName    = SubMenu.SubMenuName;
             smVM.IconClass      = SubMenu.IconClass;
         }
         return(smVM);
     }
     catch (Exception e)
     {
         throw e;
     }
 }