// GET: RoleMenuMapping
        public ActionResult Index()
        {
            RoleMenuMappingViewModels models = new RoleMenuMappingViewModels();

            models.Menu    = PopulateMenu();
            ViewBag.Uroles = db.UserRoles.ToList();
            return(View(models));
        }
        public JsonResult Update(RoleMenuMappingViewModels model)
        {
            var rmm = db.RoleMenuMappings.Where(x => x.RMId == model.RMId).SingleOrDefault();

            rmm.RoleId = model.RoleId;
            rmm.MenuId = model.MenuId;
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetbyID(int ID)
        {
            var rmm = db.RoleMenuMappings.Where(x => x.RMId == ID).SingleOrDefault();
            RoleMenuMappingViewModels model = new RoleMenuMappingViewModels();

            model = new RoleMenuMappingViewModels().ConvertFromRole(rmm);
            //model.Menu = EditPopulateMenu(model.MenuId);
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Add(RoleMenuMappingViewModels model)
        {
            var rmm = new RoleMenuMapping();

            rmm.RoleId   = model.RoleId;
            rmm.MenuId   = model.MenuId;
            rmm.IsActive = true;
            db.RoleMenuMappings.Add(rmm);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }