For those who missed my last tutorial on MVC on how to create simple blog application can try to review those by links listed below:
- Part 1 – Create Simple Blog Application
- Part 2 – Create Simple Blog Application
- Part 3 - You are reading the tutorial at this moment
- Part 4 - Create Simple Blog Application
To accomplished this, we need to use the KeyTable SQL and run the query in SQL server management studio. Below is the SQL Query to insert the KeyTable:
After run the query, we should have another table named KeyTable. Once we have the table, we are done with designing our model on LightSpeed. Now we can start to work on Post.
On Post section, we should have the idea of what should be inside the Controller. This is the basic function that we should have on Post Controller that I can think of:
- List All Post
- Edit Post
- Delete Post
- Create New Post
- Right click on Controller folder on Solution Explorer.
- Select New Controller option
- Name the Controller as 'PostController'
- Click OK.
Once we have this code in our controller, we can now create our view. To create our view, MVC come with simple method. Below is the step to create our Viewing based on the Controller that we have built just now:
- Right click on the method name. For example, method Index().
- Select Add View.
- Select strong view type option and select List.
- On model option, we choose Post (NegativeZero.Models)
So, now we already half way done on finishing our project to create a simple blog application. On my next tutorial, I'll focus on comments.
Any question and suggestion are mostly welcome. Please like this post and drop comment(s) if you this this is useful.
Blogger Labels: Create,Simple,Blog,Application,tutorial,links,Part,database,Previous,KeyTable,data,Table,server,management,studio,Query,SELECT,FROM,WHERE,BEGIN,DROP,NextId,NULL,INSERT,INTO,VALUES,Once,Post,Controller,List,Edit,Delete,PostController,folder,steps,Solution,Explorer,option,Name,Click,template,code,System,Generic,Linq,NegativeZero,Mindscape,UnitOfWork,method,Both,LightSpeedContext,context,Development,Authorize,ActionResult,Index,CreateUnitOfWork,Find,View,ToList,PostToEdit,Equals,HttpPost,Title,Author,FirstOrDefault,SaveChanges,Redirect,Length,Single,IsValid,Remove,RedirectToAction,example,scaffold,Mean,action,comments,suggestion,Collections,Controllers,Categories,postToDelete