public ActionResult Create([Bind(Include = "SubMenuId,ControllerName,ActionMethod,SubMenuName,Status,CreateDate,MenuId")] SubMenuMasterCreate subMenuMasterVm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var subMenuMaster = AutoMapper.Mapper.Map <SubMenuMaster>(subMenuMasterVm);
                    subMenuMaster.UserId = Convert.ToInt32(Session["UserID"]);
                    _subMenu.AddSubMenu(subMenuMaster);
                    return(RedirectToAction("Index"));
                }

                var menuList = _menu.GetAllMenu();
                menuList.Insert(0, new MenuMaster()
                {
                    MenuId   = -1,
                    MenuName = "---Select---"
                });

                SubMenuMasterCreate subMenu = new SubMenuMasterCreate()
                {
                    MenuList = menuList
                };

                return(View(subMenu));
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: SubMenuMaster/Edit/5
        public ActionResult Edit(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                var subMenuMaster = _subMenu.GetSubMenuById(id);

                var menuList = _menu.GetAllMenu();
                menuList.Insert(0, new MenuMaster()
                {
                    MenuId   = -1,
                    MenuName = "---Select---"
                });

                SubMenuMasterCreate subMenu = new SubMenuMasterCreate()
                {
                    MenuList       = menuList,
                    SubMenuName    = subMenuMaster.SubMenuName,
                    MenuId         = subMenuMaster.MenuId,
                    SubMenuId      = subMenuMaster.SubMenuId,
                    ActionMethod   = subMenuMaster.ActionMethod,
                    ControllerName = subMenuMaster.ControllerName,
                    Status         = subMenuMaster.Status
                };

                return(View(subMenu));
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: SubMenuMaster/Create
        public ActionResult Create()
        {
            try
            {
                SubMenuMasterCreate subMenu = new SubMenuMasterCreate();
                subMenu.MenuList = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };
                subMenu.ListofMenuCategory = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };
                subMenu.ListofRoles = _role.GetAllActiveRoles();

                return(View(subMenu));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Create(SubMenuMasterCreate subMenuMasterVm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    SubMenuMaster subMenuMaster = new SubMenuMaster()
                    {
                        SubMenuId      = 0,
                        RoleId         = subMenuMasterVm.RoleID,
                        CategoryId     = subMenuMasterVm.MenuCategoryId,
                        MenuId         = subMenuMasterVm.MenuId,
                        Status         = subMenuMasterVm.Status,
                        ActionMethod   = subMenuMasterVm.ActionMethod,
                        ControllerName = subMenuMasterVm.ControllerName,
                        SubMenuName    = subMenuMasterVm.SubMenuName,
                        CreateDate     = DateTime.Now
                    };
                    subMenuMaster.UserId = Convert.ToInt32(_sessionHandler.UserId);
                    _subMenu.AddSubMenu(subMenuMaster);
                    return(RedirectToAction("Index"));
                }

                subMenuMasterVm.MenuList = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };

                subMenuMasterVm.ListofMenuCategory = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };

                subMenuMasterVm.ListofRoles = _role.GetAllActiveRoles();

                return(View(subMenuMasterVm));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Edit([Bind(Include = "SubMenuId,ControllerName,ActionMethod,SubMenuName,Status,CreateDate,MenuId")] SubMenuMasterCreate subMenuMasterCreate)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var subMenuMaster = AutoMapper.Mapper.Map <SubMenuMaster>(subMenuMasterCreate);
                    subMenuMaster.UserId = Convert.ToInt32(Session["UserID"]);

                    _subMenu.UpdateSubMenu(subMenuMaster);
                    return(RedirectToAction("Index"));
                }
                return(View(subMenuMasterCreate));
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: SubMenuMaster/Create
        public ActionResult Create()
        {
            try
            {
                var menuList = _menu.GetAllMenu();
                menuList.Insert(0, new MenuMaster()
                {
                    MenuId   = -1,
                    MenuName = "---Select---"
                });

                SubMenuMasterCreate subMenu = new SubMenuMasterCreate()
                {
                    MenuList = menuList
                };

                return(View(subMenu));
            }
            catch (Exception)
            {
                throw;
            }
        }