Results 1 to 3 of 3

Thread: [RESOLVED] passing objects or values

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    12

    Resolved [RESOLVED] passing objects or values

    In asp.net I am checking whether the Username and password in the login view is equal to those details in the database. From the controller layer a method of service layer is accessed and from service layer the method in the repository was accessed. I want to access the object in the repository to the service layer and then to controller,How can I do this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: passing objects or values

    The same way it's always done. Use functions and get the return value. The repository method returns a result - maybe just a Boolean or maybe a User object or maybe something that incorporates either or both of those with some other information besides - and the service method uses that and then either returns it to the controller action or creates some new object that contains the appropriate data and returns that. Just as passing parameters down the layers doesn't change just because there are layers, so passing results back up the layers is no different to any other methods.

  3. #3
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: passing objects or values

    Hello,

    Based on your other threads, I am going to assume that this is also ASP.Net MVC, so I will move the thread to correct forum.

    Have you seen the following example application:

    http://www.asp.net/mvc/tutorials/mvc...c-store-part-1

    Specifically:

    http://www.asp.net/mvc/tutorials/mvc...c-store-part-7

    I think this might help you with the task that you are currently doing.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width