hi im trying to use interfaces in my MVC 5 project with the code below

    public ActionResult Index(IAccountController AccountInterface) 
    {

        var DynamicID_DDL = AccountInterface.IDMethod(); 

        var model = new loggedinViewModel
        {
            bIDlistItems = new SelectList(DynamicID_DDL)

        };

        ViewBag.DynamicID_DDL = new List<ID>(DynamicID_DDL);            

        return View(model);

    }

&

interface

   public interface IAccountController
    {
       languageSetting[] languageSettingMethod();
       ID[] IDMethod();
    }

however I get the error:

Cannot create an instance of an interface.

Why is this happening and how can I fix it ?

Thanks in advance

Related posts

Recent Viewed