'How to implementing Repository patten with entity frame work mvc

i am trying to implement repository pattern in mvc. but I am stuck. I want to return related data. I have two classes , tbl_Account (contains users )and tbl_Country (contains countries).

    public class AccountRepository : IAccount
    {
    public IEnumerable<Account> GetCountry()
    {

       var Account = this.storeDB.tbl_UserAccount.Include(s => s.tbl_Country).ToList();
        
       return Account; // it gives error here, saying explicit cast required
    }
    }

Account is a model class i have created on top of tbl_Account for field validations.

how to cast this or i am missing something else... please please help



Solution 1:[1]

1.) Variable name must start lower case.

2.) Method name 'GetCountry' but you return Account.

3.) After include you need to Select countries in account and then return countries.

4.) Please share your entities (model classes) in your question if you wanna get cool answers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Areg Gevorgyan