I love coding, coding everyday is the dream! This is one of my projects built with ASP.NET MVC, C# and Postgres to share everything I'm learning on my coding journey. Join me and checkout my portfolio to see more of my projects.
MVC stands for Models, Views, and Controllers. It's used as a design pattern that allows the software code to be understandable, organized and easier to manage by creating separation of concern. Models are the data the application works with. Views are what the user sees, the User Interface of the application. Controllers tell the model and view what to do based on the requests from the user. I use the MVC design pattern in my latest project, Bug Trail (a bug tracker/ issue tracker).
MVC (Models, Views, Controllers) is used as a design pattern that allows the software code to be understandable, organized and easier to manage. Modifications can be made to one part of the software without affecting the others so that each part has one job. This is known as separation of concern.
I use the MVC design pattern in my latest project Bug Trail (a bug tracker/ issue tracker). If you are already knowledgeable on this subject, try Bug Trail as admin and see if you can guess the models, views, and controllers that may be implemented in this project. Comment your guesses below! I'd also love to hear your feedback. If this design pattern is new for you, do not fret. Follow along with Bug Trail open and click “Demo As Admin” to get a better understanding of MVC. After following below, try to make a guess for another model, view, controller that might exist. Place your guesses in the comments below!
Models
Models are the data the application works with. For example, in Bug Trail, I have a model named Ticket which can hold data about a single ticket with properties such as Title, Description, TicketStatus and navigation properties such as SubmitterUser and Comments.
Views
Views are what the user sees, the User Interface of the application. One model can be used on a view. For example, in Bug Trail, I have a Details view which uses the Ticket model to display information to the user about a particular ticket. After logging in as admin and arriving at the Dashboard, scroll down to the tickets table and click the title of any of the tickets. I've clicked “Bug Tracker Ticket 1”. You then arrive at the Details view. As you can see, it displays information from the Ticket model with the properties mentioned earlier, Title, Description, TicketStatus, SubmitterUser, and Comments.
Controllers
Controllers tell the model and view what to do based on the requests from the user. When I clicked the “Bug Tracker Ticket 1”, it sent a request to the Tickets controller calling on the Details action with the id number of the ticket. The Details action, uses the id of the ticket to query the database through the use of the Ticket service for the information of this ticket. The Details action then returns the Ticket model to the view carrying the data of that specific ticket.
This project was set up with the default route of MVC where parts of the URL are mapped to the parameters of controller, action, and an optional parameter of id. So, if you take a look at the URL “https://bugtrail.up.railway.app/Tickets/Details/26”, you can confirm the controller = Tickets, action = Details, and id = 26.
So what do you think, can you guess another Model, View, Controller used in this project?
0 comments