V
V
Vyacheslav Kuznetsov2018-10-11 17:54:22
ASP.NET
Vyacheslav Kuznetsov, 2018-10-11 17:54:22

How to dynamically change list items in ASP.NET MVC 5?

Good afternoon!
There are two tables (Category, Specials). It is necessary that the user selects a category in the form on the site, and a list of relevant specialties is formed below.
Models:

-Category

5bbf640ba23b1941805289.png

-Specials

5bbf641542719164755784.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nordwind2013, 2018-10-22
@nordwind2013

As I understand it, your categories and specialties are connected one-to-many, so just complete the request. If you have ado.no, then you need a repository for each entity. And then you will have something like select * from SpecialsTable where categoryId = @param (where the parameter is defined in your Sharpcode like this: categoryRepository.GetAll().FirstOrDefault(c=>c.Id == your int parameter) You must describe the method yourself. You need to look for it on the metasite. Read Ado.net and the repository pattern. If you do it with EF, then it’s even a hundred times easier. I won’t write there, so everything is clear. You write the repository the same way, you also write LINQ in help for requests, I hope I helped a little.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question