Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i worked winform and asp.net.
now i wants to learn mvc.
but after several studies, i only find about controller and view and model.
i need
simple source of an asp.net mvc

which explain connect to db. and insert data to db and ...
thanks

What I have tried:

i studies very very...............


but
not get things.
Posted
Updated 2-Nov-19 22:43pm

Looking at an example app won;t help you either - it will just show you what works for one person, not why it works, or how it works - and you need those to get something working for yourself.

Go back to your course notes and read them again: then try to implement it in small stages - get a small bit working, then add on the next and get that working.
It's not complicated unless you try to throw it all together at once and hope it works - which is won't, but you will have no idea what not!
 
Share this answer
 
Quote:
i only find about controller and view and model.

You should read about the definition of MVC because I feel like you don't know that the MVC are initials of "Model View Controler"
Model–view–controller - Wikipedia[^]
 
Share this answer
 
MVC is an application design paradigm; and as such is language/code agnostic. It is more about Seperation of Concerns than it is about specific code.
MVC5 is just one specific flavor of it, centered on ASP.NET for the code.

Now, back to your question at hand; how to talk to the database.
As you have worked with both WebForms and WinForms then you should have a pretty good idea that there are a few different ways of connecting with a datasource. Some of the older methods are using the dataset designer and good old fashioned ADO. Over the last decasde MS has come out with LinqToSql and more recently Entity Framework.

Most of the tutorials that are out there for building MVC from scratch uses Entity Framework (EF) as the abstract between your Model and the database. What is nice about it is that you can build the DB from your Models in a Code First setup, or you can create the Models from an existing DB in the other setup. EF can even synch a change from your code back to the DB if you add a field or two to the Model.

As for me, all of my CRUD functions/methods are for all practicality done using ADO within my Model.
When I need to migrate web-forms, I have often just brought in the AppData folder (for all the XML data definitions) into a bare MVC app and then defined the CRUD functions to use the imported dataset methods
 
Share this answer
 
Tutorialspoint has lots of tutorials and some even have "live demo" environments: ASP.NET MVC Tutorial - Tutorialspoint[^]
it is a bit dated though, they are mentioning Visual Studio 2012.
The database chapter discusses Entity Framework which might be overkill for a simple application.
Here are some alternative lightweight databases: best-databases-for-a-small-net-application[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900