Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between asp.net MVC and MVP? are they both same?

I wanted to know the difference between asp.NET MVC and MVP, are they both same? below is the architecture diagram I referred.

(Image URL:http://msdn.microsoft.com/en-us/library/ff647859.aspx)

MVC vs MVP

the major difference I got to know between MVC and MVP from the diagram is, in MVC the Model updates the view and in MVP the Presenter updates the view.

But here is my confusion.Below is a asp.net MVC code sample.

public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return View();
        }

    }

here the Controller returns/updates the view so now according to the diagram it is MVP

Is asp.net mvc and MVP similar? if not what is the difference ?Can someone guide me.

like image 877
Dalton Avatar asked Nov 15 '13 08:11

Dalton


1 Answers

Actually MVP is a subset of MVC pattern.

In your example of asp.net mvc the controller does not updates the view rather it just pass the model to the view and the view get updated according to the model.

But in MVP (which is usually used with winforms and webforms in Microsoft stack) the presenter get data from view, updates the model and when the model changed, the presenter will read the model and updates the view.

like image 98
VahidNaderi Avatar answered Sep 19 '22 13:09

VahidNaderi