I am new to MVC and was using web forms for the last 4 years but recently moved to MVC which I find quite different.
I created a repository named basicoperations.cs which just contains an InsertMethod with a return type of bool. Then a model which contains 2 properties name, password and then a controller which contains a single action result method and is strongly bound to a view.
When I fill the 2 textboxes on the front end then it submits it to the database. Fine. I understand but what I find confusing is this:
public ActionResult AddStories2(Stories st)
{
Stories s2 = new Stories();
basicoperations bo = new basicoperations();
if (bo.insertImages(st))
{
ViewBag.Message = "Added";
}
else
{
ViewBag.Message = "Failed";
}
return View("AddStories");
}
If the view is strongly bound to the model then 1. Why do I still need a Stories object as a parameter? 2. Why the object stories s2 contains null since it's bound?