0

I'm completely new to MVC. I have the plan to develop an application that runs on both Web and on Windows. My concern is whether MVC in .net compatiable with Windows applications?

If yes is it possible to return an actionresult with windows form or webpage based on some condition something like this below?

public actionresult Index()
{
  if(some condition)
  {
    return View("webpage.html");
  }
  else
  {
    return View("Webform");
  }
}/* code may note be having exact syntax. Just for understanding purpose.

Let me know the resolution for developing an application like this is possible or not.Alternative suggestions are appreciated.

7
  • If it runs on the web then it runs in any browser, besides that i really don't understand your question. Commented Feb 12, 2013 at 19:33
  • MVC is an ASP.NET technology. (It's also a pattern) So you can use ASP.NET MVC on the web side, and if you want to use a model-view-controller pattern for your winforms then you need to either create or use an existing mvc winforms library. Commented Feb 12, 2013 at 19:36
  • @Freeman It says whether we can return windows forms as views in mvc along with web pages. Commented Feb 12, 2013 at 19:37
  • @windson And from your point of view does that make any sense? Commented Feb 12, 2013 at 19:39
  • 1
    @DanielPowell : Good Research. Keep it up :) Commented Feb 13, 2013 at 17:21

1 Answer 1

0

The ActionResult class is part of System.Web.Mvc so it is unrelated windows forms. It helps return different web related subtype results (html, json, redirects, files) to a response stream for the web/client.

I think you would have to do way to much upfront work and modification to .net to do what you described.

I would instead make some sort of common repository that could be shared by both your MVC application and you windows forms (or better yet WPF) application. There are plenty of examples out there: https://stackoverflow.com/questions/3175/repository-pattern-tutorial-in-c-sharp

This way most of the work goes into the repository and that work can be used in both your windows form app and in your controllers in the MVC app. I would also suggest building a MVVM wpf application instead because this style is very similar to the MVC pattern and that would make the repository that much more reusable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.