private static void CreateAndSaveDefaultCharity(Administrator defaultAdministrator, DataContext context)
        {
            var defaultCharity = new Charity
                {
                    SiteName = "My Charity",
                    Description = "This is a test charity"
                };

            defaultCharity.AddAdministrators(defaultAdministrator);

            context.Add(defaultCharity);
            context.SaveChanges();
        }
        private static Administrator CreateDefaultAdministrator()
        {
            var defaultAdministrator =
                new Administrator
                    {
                        UserName = DefaultAdministratorUserName,
                        FullName = "This is a test administrator"
                    };

            defaultAdministrator.AddRole(Role.Administrator);

            return defaultAdministrator;
        }
 private bool IsCurrentUser(Administrator administrator)
 {
     return administrator.UserName == UserIdentityProvider().Identity.Name;
 }
Exemplo n.º 4
0
 public void RemoveAdministrator(Administrator administratorToBeDeleted)
 {
     administratorToBeDeleted.RemoveRole(Role.Administrator);
     AdministratorCollection.Remove(administratorToBeDeleted);
 }