public RedirectToRouteResult CreateRole(string id, FormCollection fc)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            if (id != "")
            {
                if (Roles.RoleExists(id) != true)
                {
                    ///////// Save Role ////////////////
                    ser.CreateRole(id);
                    ///////// End Saving Role //////////
                    ////////// Get RoleId for saving in Core_ProductRoles table  /////////////
                    Guid roleid             = ser.GetIdbyRolename(id);
                    Core_ProductRoles model = new Core_ProductRoles();
                    model.RoleId       = roleid;
                    model.ProductId    = Convert.ToInt32(fc["ProductId"]);
                    model.SubProductId = Convert.ToInt32(fc["SubProductId"]);
                    ser.Save_RoleUserTypeMapping(model);
                    /////////////// End Role Creation ////////////
                    TempData["message"] = "Role Created Successfully";
                    return(RedirectToAction("ManageRole"));
                }
                else
                {
                    TempData["message"] = " The role " + id + " already exists.";
                    return(RedirectToAction("ManageRole"));
                }
            }
            else
            {
                TempData["message"] = "Please Enter Role Name";
                return(RedirectToAction("ManageRole"));
            }
        }
Пример #2
0
        public void EditRoleInfo(AdminUserManagementModel.CreateAdminAspUser model)
        {
            Core_ProductRoles result = db.Core_ProductRoles.Where(x => x.RoleId == model.RoleId).FirstOrDefault();

            result.RoleId       = model.RoleId;
            result.ProductId    = model.ProductId;
            result.SubProductId = 1;

            db.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            db.SaveChanges();
        }
Пример #3
0
 public void Save_RoleUserTypeMapping(Core_ProductRoles mappinfo)
 {
     db.AddToCore_ProductRoles(mappinfo);
     db.SaveChanges();
 }