1

I'm new to the ASP.NET MVC 5 and WebAPI 2 technology. I am currently developing a project for my school. This project will be used on computers or mobile.

I have a Visual Studio solution like this:

  • A project "Web.Front" - ASP.NET MVC 5 - A front website used to describe the project
  • A project "Web.Management" - ASP.NET MVC 5 - The core web application
  • A project "WebApi" - WebAPI 2 project with authentication with individual accounts
  • A project "Models" - Class library - containing my POCO classes for Code First
  • A project "Database" - Class library - containing my DbContext and migrations classes

I am having difficulty understanding how to manage users in this project.

I can create my database of my users, and through Fiddler authenticate and create/manage users in my database.

Now I want to access my users within my controllers on my project "Web.Management".

When creating it, I chose "Individual accounts" for authentication, so Visual Studio automatically generated AccountController controller.

I would like to change these methods to query my WebAPI directly.

  1. Do you think that the architecture of my solution is correct?
  2. Can you tell me how to change my controller " AccountController " to manage users through WebAPI?

Regards!

0

1 Answer 1

8

I strongly suggest you to watch http://pluralsight.com/training/Courses/TableOfContents/aspdotnet-mvc5-fundamentals

  • I would use EF Code First approach which means your model project will be also your database project.
  • Instead of seperating Front and Management I would use Areas.
  • As long as you don't use your API beside Front and Management (e.g. public API) I wouldn't split the project

so you should end up with 2 projects like below

  • Database/Model Entity Framework 6 Code-First approach
  • WebAPI + areas for WebFront/WebManagement
Sign up to request clarification or add additional context in comments.

2 Comments

Not enough people know about areas. Super helpful to use once you get a feel for them! Thanks for the reminder!
@statue and cilerler, I believe you can help me with this issue if you have 30 secs... Thks a lot! stackoverflow.com/questions/22401403/…

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.