public IActionResult SavedRoutes() { ListModelResponse <Route> routeResponse = _context.GetUserRoutes(_userManager.GetUserId(User)); if (routeResponse.DidError == true || routeResponse == null) { if (routeResponse == null) { return(View("Error")); } Error er = new Error(routeResponse.ErrorMessage); return(View("Error")); } if (routeResponse.Model != null) { ViewBag.DistanceHighest = routeResponse.Model.OrderByDescending(p => p.Distance); ViewBag.DistanceLowest = routeResponse.Model.OrderBy(p => p.Distance); ViewBag.Runs = routeResponse.Model.OrderByDescending(p => p.RunCount); ViewBag.Events = routeResponse.Model.OrderByDescending(p => p.EventCount); } string sourceCookie = HttpContext.Request.Cookies["SourcePageMap"]; if (sourceCookie != null) { ViewBag.SourcePageMap = sourceCookie; } return(View(routeResponse.Model)); }
public IActionResult CreateEvent() { ListModelResponse <Route> routeResponse = _routeContext.GetUserRoutes(_userManager.GetUserId(User)); if (routeResponse.DidError == true || routeResponse == null) { if (routeResponse == null) { return(View("Error")); } Error er = new Error(routeResponse.ErrorMessage); return(View("Error")); } if (routeResponse.Model.Any()) { ViewBag.UserRoutes = GetRoutes(null); } else { ViewBag.UserRoutes = null; } ListModelResponse <Club> clubResponse = _clubContext.GetUserClubs(_userManager.GetUserId(User)); if (clubResponse.DidError == true || routeResponse == null) { if (routeResponse == null) { return(View("Error")); } Error er = new Error(routeResponse.ErrorMessage); return(View("Error")); } if (clubResponse.Model.Any()) { ViewBag.UserClubs = GetClubs(null); } else { ViewBag.UserClubs = null; } string eventCookie = HttpContext.Request.Cookies["NewEvent"]; EventViewModel model = new EventViewModel(); if (eventCookie != null) { model = eventCookie.FromJson <EventViewModel>(); } return(View(model)); }
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)); }