// GET: PlantsController public async Task <ViewResult> Index( [FromQuery(Name = "Aanbod")] int[] aanbod, [FromQuery(Name = "Soort")] int[] soort, [FromQuery(Name = "Licht")] int[] licht, [FromQuery(Name = "Water")] int[] water, [FromQuery(Name = "Naam")] string name, [FromQuery(Name = "postcode")] string zipcode, [FromQuery(Name = "lat")] double latitude, [FromQuery(Name = "lon")] double longitude, [FromQuery(Name = "Afstand")] int distance, [FromQuery(Name = "Sort")] string sort, [FromQuery(Name = "Page")] int page = 1) { //get filters ViewData["Filters"] = _context.Filters.Include(f => f.Options).ToList(); ViewBag.plantIsEdited = TempData["plantIsEdited"] == null ? false : TempData["plantIsEdited"]; ViewBag.ratingIsCreated = TempData["ratingIsCreated"] == null ? false : TempData["ratingIsCreated"]; ViewBag.ratingIsDeleted = TempData["ratingIsDeleted"] == null ? false : TempData["ratingIsDeleted"]; ViewBag.ratingIsEdited = TempData["ratingIsEdited"] == null ? false : TempData["ratingIsEdited"]; ViewBag.reportIsSubmitted = TempData["reportIsSubmitted"] == null ? false : TempData["reportIsSubmitted"]; return(latitude != 0.0 && longitude != 0.0 ? View(await _plantRepository.GetPlantsWithDistance(_context, latitude, longitude, aanbod, soort, licht, water, name, distance, page, sort)) : View(await _plantRepository.GetPlants(_context, aanbod, soort, licht, water, name, page, sort))); }
public async Task <PaginatedResponse <Plant> > GetPlants( [FromQuery(Name = "Aanbod")] int[] aanbod, [FromQuery(Name = "Soort")] int[] soort, [FromQuery(Name = "Licht")] int[] licht, [FromQuery(Name = "Water")] int[] water, [FromQuery(Name = "Naam")] string name, [FromQuery(Name = "postcode")] string zipcode, [FromQuery(Name = "lat")] double latitude, [FromQuery(Name = "lon")] double longitude, [FromQuery(Name = "Afstand")] int distance, [FromQuery(Name = "Sort")] string sort, [FromQuery(Name = "Page")] int page = 1) { return(latitude != 0.0 && longitude != 0.0 ? await _plantRepository.GetPlantsWithDistance(_dataContext, latitude, longitude, aanbod, soort, licht, water, name, distance, page, sort) : await _plantRepository.GetPlants(_dataContext, aanbod, soort, licht, water, name, page, sort)); }
public async Task <ActionResult> Index( [FromQuery(Name = "Aanbod")] int[] aanbod, [FromQuery(Name = "Soort")] int[] soort, [FromQuery(Name = "Licht")] int[] licht, [FromQuery(Name = "Water")] int[] water, [FromQuery(Name = "Naam")] string name, [FromQuery(Name = "postcode")] string zipcode, [FromQuery(Name = "lat")] double latitude, [FromQuery(Name = "lon")] double longitude, [FromQuery(Name = "Afstand")] int distance, [FromQuery(Name = "Sort")] string sort, [FromQuery(Name = "Page")] int page = 1) { if (User.Identity.IsAuthenticated && latitude == 0.0 && longitude == 0.0) { var user = _dataContext.User.FirstOrDefault(u => u.Id == _userManager.GetUserId(User)); if (HttpContext.Request.QueryString.ToString().Length == 0) { if (user != null) { return(Redirect($"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/" + $"?lat={user.Location.X.ToString(CultureInfo.InvariantCulture)}" + $"&lon={user.Location.Y.ToString(CultureInfo.InvariantCulture)}" + $"&postcode={user.ZipCode}")); } } else { if (user != null) { return(Redirect($"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/" + $"{HttpContext.Request.QueryString.ToString()}" + $"&lat={user.Location.X.ToString(CultureInfo.InvariantCulture)}" + $"&lon={user.Location.Y.ToString(CultureInfo.InvariantCulture)}" + $"&postcode={user.ZipCode}")); } } } //get filters ViewData["Filters"] = _dataContext.Filters.Include(f => f.Options).ToList(); return(latitude != 0.0 && longitude != 0.0 ? View(await _plantRepository.GetPlantsWithDistance(_dataContext, latitude, longitude, aanbod, soort, licht, water, name, distance, page, sort)) : View(await _plantRepository.GetPlants(_dataContext, aanbod, soort, licht, water, name, page, sort))); }
public List <Plant> FetchFordTree() { try { List <Plant> ret = PlantRepository.GetPlants(true); FISLogging.Log("[200-OK] Params: "); return(ret); } catch (Exception ex) { FISLogging.Log("[E] Exception Encountered: " + ex.Message); FISLogging.Log("[E-P] Params: "); FISLogging.Log("[E-ST] " + ex.StackTrace); HttpContext.Current.Response.StatusCode = 500; throw ex; } }