
                ModelState is property of a controller and it inherits from system.web.mvc.controller.
                During form submit,ModelState takes whatever entered in form and store it in key , value pairs
                and also it stores validation errors which is associated with each value.
                Let us understand with an example,
                Scenario 1:
                I am going to submit studentname, studentaddress in site.Before that i need a link to create student.
                @Html.ActionLink('Create NewStudent', 'CreateStudent')
                If i click 'Create NewStudent' link then it goes to createstudent method.So key,value is 0 and no errors stored and hence it enters the Modelstate.isvalid to true.
                so key count is 2 and value count is 2 and no values are stored and also null errors, so ModelState.IsValid is true.
                Scenario 2:
                if i submit the createstudent page with student data,then it stores both studentname and studentaddress in modelstate dictionary class.
                so key count is 2 and value count is 2 and has student data stored and but it has no errors, so again ModelState.IsValid is true.
                so this 'if (ModelState.IsValid){}' is always true for the above condition.
                Scenario 3:
                Suppose if i include validation message like 'Studentname should not be empty' in studentdetail class.
                Now i submit the createstudent page without entering student data,then it stores both studentname and studentaddress in modelstatedictionary class.
                so key count is 2 and value count is 2 and has student data stored,but this time errormessage is stored for studentname. so ModelState.IsValid is false.
                Code Snippet:
                student.cshtml
                
                studentdetailscontroller.cs
                 
            
