C
C#•4w ago
Anna Papciak

How to properly set up view in MVC pattern?

Hello everyone, I'm studing MVC pattern in asp.net core. Could you help me how to set up view to my project? 1. I created libraries for model, repositories, and made crud/controllers in project call TNAI_FinalProject.Api as Web Api 2. Can I use this libraries to pass data on view? 3. If yes how to connect view (in visual studio for example) to these, to don't need to make over code. 4. If no, how should it looks. 5. What changes should I make in program.cs of TNAI.Web and TNAI.Api? 6. Could you describe me in example, how to code it? I attached my project structure, and couple of code. I guess it's really noob question, so plz don't judge lol.
No description
No description
No description
No description
25 Replies
Anna Papciak
Anna PapciakOP•4w ago
I forgot to tell, TNAI.Web is a fresh project of asp.net core web app (model - view - controller) in visual studio.
taner.
taner.•4w ago
Choose a framework of your choice and build the UI, which then communicates with the API
Anna Papciak
Anna PapciakOP•4w ago
How to implement communication with this structure in razor page? Any correct reference?
taner.
taner.•4w ago
Here is a repo. thats does what u are looking for: https://github.com/thbst16/dotnet-blazor-crud
GitHub
GitHub - thbst16/dotnet-blazor-crud: Modular application for databa...
Modular application for database CRUD with Blazor. Uses an in-memory database and features dummy data generation and data pagination. - thbst16/dotnet-blazor-crud
taner.
taner.•4w ago
The server project in the repo is in this case ur api
Anna Papciak
Anna PapciakOP•4w ago
Thanks dude 😎
taner.
taner.•4w ago
U welcome
Anna Papciak
Anna PapciakOP•4w ago
When I implement this, I will close the post and give a link to the repo If somebody is interested.
fayton
fayton•4w ago
hey, i am interested in yoru project! pls send me the repo wehn you are done
Anton
Anton•4w ago
this is blazor
taner.
taner.•4w ago
No description
Anton
Anton•4w ago
they asked for razor pages, not components
taner.
taner.•4w ago
The pages are in razor?
Anton
Anton•4w ago
razor is what the template engine is called basicallt razor pages mean static pages generated from a template static as in without continuous interactivity razor components have to do with blazor
taner.
taner.•4w ago
Ah i see my bad
Anna Papciak
Anna PapciakOP•4w ago
Wait wait I was looking for an implementation of get pass data from server on UI, I guess it doesn't matter this is blazor or razor pages. Change my mind if I'm wrong I'm going ahead right now, so I will check it
Anton
Anton•4w ago
what does that mean? "get pass data from server on UI"
Anna Papciak
Anna PapciakOP•4w ago
It means you are "taking" informations from server, to see these on view
Anton
Anton•4w ago
what does "taking" mean?
Anna Papciak
Anna PapciakOP•4w ago
for example
No description
Anton
Anton•4w ago
continuously listening on events? polling for updates? one-time request-response? this is templating
Anna Papciak
Anna PapciakOP•4w ago
and this?
No description
Anton
Anton•4w ago
In principle, templating doesn't have to do with servers or the client that's a controller
Anna Papciak
Anna PapciakOP•4w ago
but is this getting data from server?
Anton
Anton•4w ago
thing that exposes http endpoints of the server to the clients no, it's not, it's on the server exclusively it doesn't run on the client the client makes requests to the server and gets back data that you return in your endpoints the client makes an http request

Did you find this page helpful?