Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:56:21+00:00 2026-06-12T21:56:21+00:00

I was wondering if the solution I make could be done smarter, and well

  • 0

I was wondering if the solution I make could be done smarter, and well I guess so. My problem is that I got a class libary where I Keep all my methods. Then I got my MVC where I use a model. These two model are the same, but I need to convert those, and its stupid.

In my class libary I use Entity Framework, where I get the self generated classes.

In my MVC Model class I create a class so I can put on regular expression and so.

The problem: when I want to send a method back I often just want to send the object I get in return from my view. Im tired of creating an instance of an object and then do this:

    [HttpPost]
    public ActionResult CreateUser(UserModel user)
    {
        //my class libary / entity framework class for a user
        User efUser = new User();
        efUser.Email = user.Email;
        efUser.Username = user.Username;
        efUser.Password = user.Password;

        UserBLL userBLL = new UserBLL();

        //send the method to classlibary / logic layer
        userBLL.CreateUser(efUser);

        return RedirectToAction("Index");
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:56:22+00:00Added an answer on June 12, 2026 at 9:56 pm

    Here’s something I posted on a similar question! Hope it helps you understand layering your apps in MVC better and also you should probably turn the methods on your BLL to non-static to be able to effectively test your application!

    Answer:

    From a high-level view, when you think about application architecture i.e. data layer, business logic layer and presentation layer, MVC should only be your presentation layer. I have often seen people make the mistake of thinking that in MVC, models represent their data layer, controllers represent the business logic layer and views represent the presentation layer.

    You should always have a separate business logic layer (or services layer) which your MVC controllers access to carry out business logic, and also a separate data access layer (or repositories) which is only accessed by your services/business logic layer to retrieve data out of the database.

    In your typical MVC application, you may have multiple view models representing the same data layer object (which typically represents a database table). For example, you may have 2 views for to represent information about a person; one is a summary view and the other is a details view. In your MVC application you will have 2 View Models i.e. PersonSummary and PersonDetail both of which are populated from the same Persons table in the data layer and are returned to your Controller Action when your controller calls methods (e.g. GetPersonSummary() and GetPersonDetails()) on the PersonService class (business logic layer).

    Layering your applications in this way will make them far more maintainable and testable than treating your View Models as data models and writing all your business logic in the Controller actions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a problem I was wondering if there's an elegant solution to. It
Premise This problem has a known solution (shown below actually), I'm just wondering if
I'm wondering if there is an optimal solution for this problem: I have a
Hi I'm wondering if anyone could shed some light on the following problem for
I'm designing a UI manager class that will manage all my UI elements (this
I am wondering if there's an elegant solution for doing this in Java (besides
I am wondering about the most elegant solution of having a grid with each
I'm wondering if anyone has a recursive solution to converting an array to a
I'm wondering if there's a solution to this: (possibly not, but you never know!)
I'm wondering if there's a good hosted solution for managing friend invites (ala LinkedIn)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.