On the demo page for Server filtering in ASP.NET Core AutoComplete the DataSource property is setup to read products using the GetProducts action of the Home controller:
read.Action(
"GetProducts"
,
"Home"
);
Anyway you could publish the contents of the GetProducts action?
4 Answers, 1 is accepted
Here's the content of the GetProducts action:
public
JsonResult GetProducts(
string
text)
{
using
(var northwind = GetContext())
{
var products = northwind.Products.Select(product =>
new
ProductViewModel
{
ProductID = product.ProductID,
ProductName = product.ProductName,
UnitPrice = product.UnitPrice.Value,
UnitsInStock = product.UnitsInStock.Value,
UnitsOnOrder = product.UnitsOnOrder.Value,
Discontinued = product.Discontinued
});
if
(!
string
.IsNullOrEmpty(text))
{
products = products.Where(p => p.ProductName.Contains(text));
}
return
Json(products.ToList());
}
}
The demos can be run locally through our Sample Application. It allows you to review in more detail their implementation and modify/test them. Instructions on running the sample application are available in this documentation article.
Regards,
Ivan Danchev
Telerik by Progress
This is good to know, but there are two issues: first, these code-gaps on the demo-site are *everywhere*, ever since it was redone (when the old, default ASPX examples were dumped). This is glaring hole. It makes the demo site almost useless, because key pieces of code, without which the example will not function, are missing. Further, there is no pointer on the demo site that even addresses this lacuna, or points to the Sample Application.
Second issue: the sample application is out of date. It hasn't been updated since July 2016, it hasn't been renamed from "MVC 6" to "Core", the instructions require VS 2015, etc. I'll clone it so that I can look at the code, but will it really be usable as an example project that I can "play" with? There have been a lot of changes in project structure since then.
My bad--I just saw the "deprecation notice" on the github repo.
> The repository has been deprecated in favor of our official distribution packages.
However, the documentation itself still points to it, still refers to VS 2015, etc.
Thank you for the feedback. We will make sure to update the documentation as soon as possible so that it properly reflects the supported Core version.
Regards,
Ivan Danchev
Telerik by Progress