public IFeedbackLogic GetFeedbackLogic()
 {
     if (_feedbackLogic == null)
     {
         _feedbackLogic = new FeedbackLogic(_configuration, _hostingEnvironment);
     }
     return(_feedbackLogic);
 }
 public FeedbacksController(IFeedbackLogic feedbackLogic)
 {
     _feedbackLogic = feedbackLogic;
 }
 public IFeedbackModule SetFeedbackLogic(IFeedbackLogic feedbackLogic)
 {
     _feedbackLogic = feedbackLogic;
     return(this);
 }
Beispiel #4
0
        static Dependencies()
        {
            var roleDaoSet = ConfigurationManager.AppSettings["roleDaoSet"];

            switch (roleDaoSet)
            {
            case "1":
                roleDao = new RoleDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(roleDaoSet)}!");
            }

            var userDaoSet = ConfigurationManager.AppSettings["userDaoSet"];

            switch (userDaoSet)
            {
            case "1":
                userDao = new UserDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(userDaoSet)}!");
            }

            var customerDaoSet = ConfigurationManager.AppSettings["customerDaoSet"];

            switch (customerDaoSet)
            {
            case "1":
                productDao = new ProductDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(customerDaoSet)}!");
            }

            var productDaoSet = ConfigurationManager.AppSettings["productDaoSet"];

            switch (productDaoSet)
            {
            case "1":
                customerDao = new CustomerDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(productDaoSet)}!");
            }

            var orderDaoSet = ConfigurationManager.AppSettings["orderDaoSet"];

            switch (orderDaoSet)
            {
            case "1":
                orderDao = new OrderDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(orderDaoSet)}!");
            }

            var orderProductDaoSet = ConfigurationManager.AppSettings["orderProductDaoSet"];

            switch (orderProductDaoSet)
            {
            case "1":
                orderProductDao = new OrderProductDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(orderProductDaoSet)}!");
            }

            var managerDaoSet = ConfigurationManager.AppSettings["managerDaoSet"];

            switch (managerDaoSet)
            {
            case "1":
                managerDao = new ManagerDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(managerDaoSet)}!");
            }

            var loggerDaoSet = ConfigurationManager.AppSettings["loggerDaoSet"];

            switch (loggerDaoSet)
            {
            case "2":
                loggerDao = new LoggerDaoFile();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(loggerDaoSet)}!");
            }

            var feedbackDaoSet = ConfigurationManager.AppSettings["feedbackDaoSet"];

            switch (feedbackDaoSet)
            {
            case "1":
                feedbackDao = new FeedbackDaoDb();
                break;

            default:
                throw new ConfigurationErrorsException($"Can't find settings for {nameof(feedbackDaoSet)}!");
            }

            RoleLogic         = new RoleLogic(roleDao, loggerDao);
            UserLogic         = new UserLogic(userDao, loggerDao);
            CustomerLogic     = new CustomerLogic(customerDao, loggerDao);
            ProductLogic      = new ProductLogic(productDao, loggerDao);
            OrderLogic        = new OrderLogic(orderDao, loggerDao);
            OrderProductLogic = new OrderProductLogic(orderProductDao, loggerDao);
            ManagerLogic      = new ManagerLogic(managerDao, loggerDao);
            LoggerLogic       = new LoggerLogic(loggerDao);
            FeedbackLogic     = new FeedbackLogic(feedbackDao, loggerDao);
        }