Category Archives: MVC

What is ViewModel in MVC?

People usually get scared and confused when they hear the word View Model in MVC. View Model is a hidden layer in ASP.NET MVC applications. View Model is not a part of MVC. It’s something brought up by community for maintaining SOC. SOC –Separation of concerns – It means everyone will do only that which

Read More

Understanding TempData in detail

What is TempData? Tempdata let us maintain data within single request cycle Example: publicActionResult M1() { TempData[“a”] = “Value”; string s = TempData[“a”].ToString(); returnRedirectToAction(“M2”); } publicActionResult M2() { string s = TempData[“a”].ToString(); // Data will be available returnRedirectToAction(“M3”); } publicActionResult M3() { string s = TempData[“a”].ToString(); // Data will be available returnview (“Some View”); //

Read More