using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NetMagazine_MVC3_Parte3.Models;
using Ninject;
using Ninject.Modules;
using Ninject.Parameters;

namespace NetMagazine_MVC3_Parte3.Infra
{
    public class ResolvedorDependencias : IDependencyResolver
    {
        private IKernel kernel;
        public ResolvedorDependencias(IKernel kernel)
        {
            this.kernel = kernel;
        }

        public object GetService(Type serviceType)
        {
            return this.kernel.TryGet(serviceType, new IParameter[0]);
        }

        public IEnumerable<object> GetServices(Type serviceType)
        {
            return this.kernel.GetAll(serviceType, new IParameter[0]);
        }
    }

    public class MeuModulo : NinjectModule
    {
        public override void Load()
        {
            Bind<IListaDePedidos>().To<RepositorioPedidos>();
        }
    }
}