This is a migrated thread and some comments may be shown as answers.

Source of GetProducts Action on Home Controller

4 Answers 153 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Bret
Top achievements
Rank 1
Bret asked on 16 Dec 2016, 07:15 PM

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

Sort by
0
Ivan Danchev
Telerik team
answered on 21 Dec 2016, 01:24 PM
Hello Bret,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 16 May 2017, 02:59 PM

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.

0
Marc
Top achievements
Rank 1
answered on 16 May 2017, 03:12 PM

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.

0
Ivan Danchev
Telerik team
answered on 18 May 2017, 02:46 PM
Hello Marc,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoComplete
Asked by
Bret
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Marc
Top achievements
Rank 1
Share this question
or