internal static bool RemoveAdmin(ApplicationDbContext context, AdminIndexViewModel model)
        {
            bool adminRemoved;
            var  admin = context.Users.Where(a => a.Email == model.Email).FirstOrDefault();

            if (admin != null)
            {
                var adminStatus = context.UserRoles.Where(a => a.UserId == admin.Id).FirstOrDefault();
                if (adminStatus != null)
                {
                    context.Remove(adminStatus);
                    context.SaveChanges();
                    adminRemoved = true;
                }
                else
                {
                    adminRemoved = false;
                }
            }
            else
            {
                adminRemoved = false;
            }
            return(adminRemoved);
        }
        internal static bool DeleteUser(ApplicationDbContext context, AdminIndexViewModel model)
        {
            bool userDeleted;
            var  user = context.Users.Where(l => l.Email == model.Email).FirstOrDefault();

            if (user != null)
            {
                context.Remove(user);
                context.SaveChanges();
                userDeleted = true;
            }
            else
            {
                userDeleted = false;
            }
            return(userDeleted);
        }
        internal static List <HandleLocationViewModel> GetLocations(NewHorizonsDBContext contextNH, ApplicationDbContext context, AdminIndexViewModel model)
        {
            List <HandleLocationViewModel> locationList = new List <HandleLocationViewModel>();

            if (model.Name != null)
            {
                var listDB = contextNH.Markers.Where(m => m.Name.Contains(model.Name)).ToList();
                if (listDB != null)
                {
                    foreach (var m in listDB)
                    {
                        locationList.Add(new HandleLocationViewModel()
                        {
                            ID          = m.ID,
                            Name        = m.Name,
                            Adress      = m.Adress,
                            Hours       = m.Hours,
                            Description = m.Description,
                            UserID      = m.UserID
                        });
                    }
                    return(locationList);
                }
                else
                {
                    return(null);
                }
            }
            if (model.Email != null)
            {
                var user = context.Users.Where(u => u.Email == model.Email).FirstOrDefault();
                if (user != null)
                {
                    var listDB = contextNH.Markers.Where(m => m.UserID == user.Id).ToList();
                    if (listDB != null)
                    {
                        foreach (var m in listDB)
                        {
                            locationList.Add(new HandleLocationViewModel()
                            {
                                ID          = m.ID,
                                Name        = m.Name,
                                Adress      = m.Adress,
                                Hours       = m.Hours,
                                Description = m.Description,
                                UserID      = m.UserID
                            });
                        }
                        return(locationList);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }