none
in my application i want to return Ilist from context?Given blow code showing error can you please help me any one? RRS feed

  • Question

  •         private static IList GetOrders(string Countryid)
            {
                var list = context.Orders.Where(m => m.CustomerID == Countryid).ToList();
                return list;
            }
    Saturday, November 2, 2019 5:01 AM

All replies

  • private static List<Orders> GetOrders(string Countryid)
            {
                var list = context.Orders.Where(m => m.CustomerID == Countryid).ToList();
                return list;
            }

    The above is what it should be, becuase the list is a List<t> of Orders.  Also, Countryid as the criteria to fine Orders by CustomerId seems kind of suspect.

    In addition  making a post about some error, then the error should be posted in the post too in future posts.  

    • Edited by DA924x Saturday, November 2, 2019 7:57 AM
    • Proposed as answer by CoolDadTxModerator Monday, November 4, 2019 3:00 PM
    Saturday, November 2, 2019 7:55 AM

  • Hi Vijay,

    Thank you for posting here.

    You didn't provide any information about your error. I don't know what can I do for you.

    Can you provide some information about the context.Order and the error you have?

    Best Regards,

    Timon



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 4, 2019 2:44 AM
  • Maybe ID is a number? Then try this: ‘private static IList GetOrders(int CustomerId)’.

    Monday, November 4, 2019 5:52 AM