Exemplo n.º 1
0
        public static bool Save(SoftFluent.Samples.AspNetIdentity2.Role role)
        {
            if ((role == null))
            {
                return(false);
            }
            bool ret = role.Save();

            return(ret);
        }
Exemplo n.º 2
0
        public System.Threading.Tasks.Task AddToRoleAsync(SoftFluent.Samples.AspNetIdentity2.User user, string roleName)
        {
            SoftFluent.Samples.AspNetIdentity2.Role role = SoftFluent.Samples.AspNetIdentity2.Role.LoadByName(roleName);
            if (role == null)
            {
                throw new System.ArgumentException(string.Format("role '{0}' not found", roleName), "roleName");
            }

            role.Users.Add(user);
            role.Save();
            return(System.Threading.Tasks.Task.FromResult(0));
        }