//user role assign
        public JsonResult SaveUserRoleData(UserRolesRelation Model)
        {
            UserRolesRelationData UserRolesRelationData = new UserRolesRelationData();
            var Data = UserRolesRelationData.AddUserRoleRelation(Model);

            return(new JsonResult {
                Data = Data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #2
0
        public List <dynamic> AddUserRoleRelation(UserRolesRelation UserRolesRelation)
        {
            List <dynamic> objDynamic = new List <dynamic>();

            UserRolesRelationDTO UserRolesRelationDTO = new UserRolesRelationDTO();

            try
            {
                switch (UserRolesRelation.Type)
                {
                case 2:
                {
                    var Data = JsonConvert.DeserializeObject <List <UserRolesRelationDTO> >(UserRolesRelation.UserRoledet);


                    for (int i = 0; i < Data.Count; i++)
                    {
                        UserRolesRelationDTO.Type      = 1;                        // Data[i].Type;
                        UserRolesRelationDTO.UserId    = UserRolesRelation.UserId; //Data[i].UserId;
                        UserRolesRelationDTO.CurUserId = Convert.ToInt64(UserID);
                        UserRolesRelationDTO.RoleId    = Data[i].RoleId;
                        UserRolesRelationDTO.IsCat     = Data[i].IsCat;
                        UserRolesRelationDTO.IsActive  = Data[i].IsCat;
                        UserRolesRelationDTO.URRId     = Data[i].URRId;

                        AddUpdateUserRolesRelation(UserRolesRelationDTO);
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
            }


            objDynamic.Add(UserRolesRelationDTO);
            return(objDynamic);
        }