// GET: Admin
 public ActionResult Index()
 {
     if (ManageCookie.isAdmin() == false)
     {
         return(RedirectToAction("Index", "Home"));
     }
     ViewBag.Title = "Admin Page";
     return(View());
 }
        public ActionResult Statistics()
        {
            ViewBag.Title = "Statistics";
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }
        public ActionResult updateEvent(FormCollection eventUpdate)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }

            AdminModel.updateEventInput(eventUpdate);
            return(RedirectToAction("Events", "Admin"));
        }
        public ActionResult Places(FormCollection form)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Places Managments";

            ViewBag.PlacesList = AdminModel.filterPlaces(form);

            return(View());
        }
        public ActionResult Events()
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Events Managments";

            ViewBag.EventsList = AdminModel.getEventsList();

            return(View());
        }
        public ActionResult EditPlace(FormCollection userUpdate)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Place Edit";

            bool isUpdate = AdminModel.updatePlaceInput(userUpdate);

            return(RedirectToAction("Places"));
        }
        public ActionResult EditUser(FormCollection userUpdate)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "User Edit";

            bool updateStatus = AdminModel.updateUserInput(userUpdate);

            return(RedirectToAction("Users"));
        }
        public ActionResult Users()
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Users Managments";

            //ViewBag.UserList = AdminModel.filterUsers(model);
            ViewBag.UserList = AdminModel.getUsersList();

            return(View());
        }
        public ActionResult EditEvent(int eventID)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Event Edit";

            //check event exist
            if (!SportEventModel.isEventExists(eventID))
            {
                return(RedirectToAction("Events"));
            }

            ViewBag.eventInfo      = AdminModel.getEventInfo(eventID);
            ViewBag.eventAttenides = AdminModel.getEventAttendies(eventID);
            return(View());
        }
        public ActionResult EditUser(int id)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "User Edit";

            //check event exist
            if (!AccountModel.isUserExists(id))
            {
                return(RedirectToAction("Users"));
            }

            ViewBag.userInfo = AdminModel.getUserInfo(id);

            return(View());
        }
        public ActionResult EditPlace(int id)
        {
            if (ManageCookie.isAdmin() == false)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.Title = "Place Edit";

            //check event exist
            if (!PlacesModel.isPlaceExists(id))
            {
                return(RedirectToAction("Places"));
            }

            ViewBag.placeInfo = AdminModel.getPlaceInfo(id);

            return(View());
        }