Basic of asp.net MVC




in this blog we will be learning about 

  • CURD operation using entity framework
    • database first approach
    • code first approach
  • CURD using jQuery and Ajax
  • Authentication and authorization


What is ASP.NET MVC?
  • platform / web technology to develop web applications
  • MVC stands for model view controller
  • models is class that represents database objects/tables
  • controllers handle user request all logic like insert, update, delete ,select
  • view is page that is shown to user

View is basically a cshtml file in that file we have multiple option to keep hyperlink 
lets learn 3 way to put hyperlink option
1. a anchor tag
2. url action
3. html action link

1. a anchor tag
<a href="/controller name/View" >

2. url action
href="@url.Action("View ","Controller ")"


3 html aciton link
this is mostly used method to hyperlink in dotnet framework

@Html.ActionLink("Text ","View ", "Controller ")


To access value we have 2 concept 
1. view to controller
2. Controller to view

we have form in asp.net which is used to pass value from view to controller
for that 
@using (Html.BeginForm(ActionNamme, controller, method, ))
{

}

Its recommend to use html helper 
@Html
and you will gets lots of form field property


controller to view

we have 3 method or 3 property
1. viewbag
2. viewdata
3. tempdata

ViewData is nothing but a dictionary of objects and it is accessible by string as key,is a property of controller that exposes an instance of the ViewDataDictionary class,ViewData is very similar to ViewBag. ViewBag is a dynamic property (dynamic keyword which is introduced in .net framework 4.0). ViewBag is able to set and get value dynamically and able to add any number of additional fields without converting it to strongly typed. Both are used to transfer data from Controller to View.

TempData is used to move data from one controller to another or one action to another also it internally use


Comments