Ejemplo n.º 1
0
        public IActionResult Events()
        {
            ListModelResponse <Event> eventResponse = _context.GetUserEvents(_userManager.GetUserId(User));

            if (eventResponse.DidError == true || eventResponse == null)
            {
                if (eventResponse == null)
                {
                    return(View("Error"));
                }
                Error er = new Error(eventResponse.ErrorMessage);
                return(View("Error"));
            }
            IEnumerable <Event> events = eventResponse.Model;

            ViewBag.ActiveEvents = GetActiveEvents(events);
            ViewBag.OpenEvents   = GetOpenEvents(events);
            ViewBag.ClosedEvents = GetClosedEvents(events);

            string sourceCookie = HttpContext.Request.Cookies["SourcePageEvent"];

            if (sourceCookie != null)
            {
                ViewBag.SourcePageEvent = sourceCookie;
            }
            return(View(eventResponse.Model));
        }
Ejemplo n.º 2
0
        public IActionResult Default()
        {
            HomeViewModel             model         = new HomeViewModel();
            ListModelResponse <Event> routeResponse = _context.GetUserEvents(_userManager.GetUserId(User));

            if (routeResponse.DidError == true || routeResponse == null)
            {
                if (routeResponse == null)
                {
                    return(View("Error"));
                }
                Error er = new Error(routeResponse.ErrorMessage);
                return(View("Error"));
            }
            ListModelResponse <Route> eventResponse = _routeContext.GetUserRoutes(_userManager.GetUserId(User));

            if (eventResponse.DidError == true || eventResponse == null)
            {
                if (eventResponse == null)
                {
                    return(View("Error"));
                }
                Error er = new Error(eventResponse.ErrorMessage);
                return(View("Error"));
            }
            int nrEvents = eventResponse.Model.Count();
            int nrRoutes = routeResponse.Model.Count();

            model.NumberOfEvents = nrEvents;
            model.NumberOfRoutes = nrRoutes;
            return(View(model));
        }