Example #1
0
        /// <summary>
        /// Inserts a new Role in the Roles table
        /// </summary>
        /// <param name="roleName">The role's name</param>
        /// <returns></returns>
        public int Insert(IdentityRole role)
        {
            ConnectionService.ThreadVanityUrl = ConnectionName;

            AspNetRoles newRole = new AspNetRoles();

            SetConnection(newRole);
            newRole.Id   = role.Id;
            newRole.Name = role.Name;
            newRole.Save();

            return(1);
        }
Example #2
0
        public int Update(IdentityRole role)
        {
            ConnectionService.ThreadVanityUrl = ConnectionName;

            AspNetRoles roleToUpdate = new AspNetRoles();

            SetConnection(roleToUpdate);
            roleToUpdate.AcceptChanges();

            roleToUpdate.Id   = role.Id;
            roleToUpdate.Name = role.Name;
            roleToUpdate.Save();

            return(1);
        }
Example #3
0
        /// <summary>
        /// Deltes a role from the Roles table
        /// </summary>
        /// <param name="roleId">The role Id</param>
        /// <returns></returns>
        public int Delete(string roleId)
        {
            try
            {
                ConnectionService.ThreadVanityUrl = ConnectionName;

                AspNetRoles role = new AspNetRoles();
                SetConnection(role);
                role.Id = roleId;
                role.AcceptChanges();
                role.MarkAsDeleted();
                role.Save();
            }
            catch { }

            return(1);
        }