What is the ASP.NET Core MVC equivalent to Request.RequestURI?
I am trying to set up an ASP.NET Core implementation of JSGrid. The example provided they provide is pre-Core so I am having some problems converting the source code to ASP.NET Core.
Getting stuck on converting one last error on Request.RequestUri.Query
I read this post but couldn't figure out how it applied to my case and it's also 3 years old. I'm hoping that Microsoft has provided a new using
which will handle RequestUri
by now but I can't seem to find it.
Here's my controller so far.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Deviation.Data;
using System.Collections.Specialized;
using System.Web;
namespace Deviation.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class JSGridController : ControllerBase
{
private readonly DeviationContext _context;
public JSGridController(DeviationContext context)
{
_context = context;
}
public IEnumerable<object> Get()
{
ClientFilter filter = GetFilter();
var result = _context.MissedDeliveries.Where(c =>
(String.IsNullOrEmpty(filter.Delivery) || c.Delivery.Contains(filter.Delivery))
);
return result.ToArray();
}
private ClientFilter GetFilter()
{
NameValueCollection filter = HttpUtility.ParseQueryString(Request.RequestUri.Query);
return new ClientFilter
{
Delivery = filter["Delivery"],
};
}
}
}
Many thanks to anyone who could provide a bit of guidance.