BgEngine.Infraestructure.Security.CodeFirstMembershipProvider.DeleteAccount C# (CSharp) Метод

DeleteAccount() публичный Метод

public DeleteAccount ( string userName ) : bool
userName string
Результат bool
        public override bool DeleteAccount(string userName)
        {
            if (string.IsNullOrEmpty(userName))
                    {
                        throw CreateArgumentNullOrEmptyException("userName");
                    }
                    using (BlogUnitOfWork context = new BlogUnitOfWork(new ModelContextInit()))
                    {
                        dynamic user = context.Users.FirstOrDefault(Usr => Usr.Username == userName);
                        if (user == null)
                        {
                            return false;
                        }
                        context.Users.Remove(user);
                        context.SaveChanges();
                        return true;
                    }
        }