1

I'm about to start a new project in ASP.NET MVC5, which has a bit of Web API too. I'll also need a Windows Forms client which will call the API. This client has a file system watcher that detects when a file has been changed, and will post the contents to the API.

When the API receives the data, it does some calculations, and ideally will send the results through SignalR to the browser and update the display.

I'm getting rather stuck trying to work out the authentication. I want to use Individual User Accounts, so the user can log in with the Windows Forms client (and get a token) and in the browser to view the data.

I've got as far as File -> New -> Project, and tried an MVC project with the Web API box checked, and a Web API with the MVC box checked. Looking at the two AccountController classes that these generate, they seem quite different.

I guess the options are

  1. Try to get these two controllers working together
  2. Call the MVC controller from the Windows Forms client
  3. Have two projects in the solution and try to work out how to use SignalR to talk between them.
  4. A better way?

I suspect the last one. I've not used Web API before, so I could be doing this all wrong. What approach should I take?

1 Answer 1

1

I would say, create 2 different projects, 1 for MVC 1 for API. Use 1 BLL which is referenced in both of them and carries the logic for both of them and will not be dealing with separate controllers.

Of course if you need other layers like DataAccess or Repository, you have to create them once and they will be referenced in the BLL which is later referenced in both MVC and API interfaces.

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

1 Comment

Sorry I am jumping in a bit late but I have to shift a products architecture from WCF to Web API. The previous architecture included BLL and we could call methods internally within the application. Now with WEB API, since everything is exposed over HTTP, should I omit BLL. If no how can I call BLL methods internally within my application.

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.