Click here to Skip to main content
15,889,659 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my Business layer ,this code returns only a single value,
How to return a list of value from DataLayer.


C#
public class GetLocal
  {
      public BusinessObj.Tables.GetLocal GetItem(int TransId)
      {
          DataLayer.PL.GetLocal objGetLocalDL = new DataLayer.PL.GetLocal();

          try
          {
              return objGetLocalDL.GetItem(TransId);

          }
          catch (Exception ex)
          {
              throw new Exception(ex.Message, ex.InnerException);
          }
      }
  }
Posted
Comments
Vedat Ozan Oner 18-Jun-14 4:45am    
you should know how. because it (objGetLocalDL) is your implementation. if not yours, ask to whom implemented this 'data layer'.
Sampath Lokuge 18-Jun-14 5:26am    
Please put the code snippet which it related to the 'GetItem(TransId)' method in Repository layer.

1 solution

You would change

C#
public BusinessObj.Tables.GetLocal GetItem(int TransId)

to
C#
public List<businessobj.tables.getlocal> GetItem(int TransId)
</businessobj.tables.getlocal>


and then in your code you need to instantiate a new List<> of your object, add items to it, and then return it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900