コード例 #1
0
ファイル: QuotesModule.cs プロジェクト: marcusoftnet/AbbeSays
        public QuotesModule(IQuotesRepository quotesRepository)
            : base("/Quotes/")
        {
            db = Database.Open();

            Get["{Id}"] = parameters => { return View["quote.cshtml", GetQuoteVm(parameters.Id)]; };

            Get[""] = parameters => { return View["quoteList.cshtml", GetIndexVm(string.Empty)]; };

            Get["/Kid/{KidName}"] = parameters => { return View["quoteList.cshtml", GetIndexVm(parameters.KidName)]; };

            Post["AddLike"] = parameters =>
                {
                    var quoteId = IDFromLikedURL;
                    quotesRepository.AddLikeForQuote(quoteId);

                    return Response.AsJson(string.Format(LIKE_INCREMENTED_FORMAT, quoteId));
                };

            Post["RemoveLike"] = parameters =>
                {
                    var quoteId = IDFromLikedURL;
                    quotesRepository.RemoveLikeForQuote(quoteId);

                    return Response.AsJson(string.Format(LIKE_DECREMENTED_FORMAT, quoteId));
                };
        }
コード例 #2
0
 public ArtistService(IArtistRepository artistRepository,
                      IQuotesRepository quotesRepository,
                      IArtRepository artsRepository)
 {
     this.artistRepository = artistRepository;
     this.quotesRepository = quotesRepository;
     this.artsRepository   = artsRepository;
 }
コード例 #3
0
 public UserController(ILogger <UserController> logger, IUserAnsweredQuotesRepository answeredQuotesRepo,
                       IUsersRepository usersRepo, IQuotesRepository quotesRepo)
 {
     _logger             = logger;
     _answeredQuotesRepo = answeredQuotesRepo;
     _usersRepo          = usersRepo;
     _quotesRepo         = quotesRepo;
 }
コード例 #4
0
 public QuotesAPIController(IQuotesRepository quoteRepository, IUserAnswerRepository userAnswer, UserManager <User> userManager,
                            SignInManager <User> signInManager)
 {
     _quotesRepository = quoteRepository;
     _userAnswer       = userAnswer;
     _signInManager    = signInManager;
     _userManager      = userManager;
 }
コード例 #5
0
 public QuotesController(ILogger <QuotesController> logger, IQuotesRepository quotesRepo, IAuthorsRepository authorsRepo, IConfiguration config)
 {
     _logger      = logger;
     _quotesRepo  = quotesRepo;
     _authorsRepo = authorsRepo;
     if (long.TryParse(config["maxedAllowedIntervalForQuote"], out var val))
     {
         _maxedAllowedIntervalForQuote = val;
     }
 }
コード例 #6
0
 /// <summary>
 ///In constructor, we can get needed classes/interfaces.
 ///They are sent here by dependency injection system automatically.
 /// </summary>
 public QuotesAppService(IInquiryRepository inquiryRepository,
     IInquiryExtRepository inquiryExtRepository,
     ICriteriaValuesRepository criteriaValuesRepository,
     ISubscriberRepository subscriberRepository,
     ISubscriberCriteriaRepository subscriberCriteriaRepository,
     INotificationRepository notificationRepository,
     IRequestRepository requestRepository,
     IQuotesRepository quoteRepository,
     ISubscriberQuoteRepository subscriberQuoteRepository,
     ISubscriberCreditsRepository subscriberCreditsRepository,
     ICompanyConfigRepository companyConfigRepository)
 {
     _inquiryExtRepository = inquiryExtRepository;
     _inquiryRepository = inquiryRepository;
     _criteriaValuesRepository = criteriaValuesRepository;
     _subscriberRepository = subscriberRepository;
     _subscriberCriteriaRepository = subscriberCriteriaRepository;
     _notificationRepository = notificationRepository;
     _requestRepository = requestRepository;
     _quoteRepository = quoteRepository;
     _subscriberQuoteRepository = subscriberQuoteRepository;
     _subscriberCreditsRepository = subscriberCreditsRepository;
     _companyConfigRepository = companyConfigRepository;
 }
コード例 #7
0
 private static void SetOriginalValue(int entityId, Table t, Field f, Translation translation)
 {
     if (t == Table.Articles)
     {
         IArticleRepository repository = DependencyResolver.Current.GetService <IArticleRepository>();
         Article            item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Certificates)
     {
         ICertificatesRepository repository = DependencyResolver.Current.GetService <ICertificatesRepository>();
         Certificate             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.Contacts)
     {
         IContactsRepository repository = DependencyResolver.Current.GetService <IContactsRepository>();
         Contact             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Languages)
     {
         ILanguagesRepository repository = DependencyResolver.Current.GetService <ILanguagesRepository>();
         Language             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.PortfolioDetails)
     {
         IPortfolioDetailsRepository repository = DependencyResolver.Current.GetService <IPortfolioDetailsRepository>();
         PortfolioDetail             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.Portfolios)
     {
         IPortfoliosRepository repository = DependencyResolver.Current.GetService <IPortfoliosRepository>();
         Portfolio             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.ProductCategories)
     {
         IProductCategoriesRepository repository = DependencyResolver.Current.GetService <IProductCategoriesRepository>();
         ProductCategory item = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Products)
     {
         IProductsRepository repository = DependencyResolver.Current.GetService <IProductsRepository>();
         Product             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Quotes)
     {
         IQuotesRepository repository = DependencyResolver.Current.GetService <IQuotesRepository>();
         Quote             item       = repository.GetById(entityId);
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Sliders)
     {
         ISlidersRepository repository = DependencyResolver.Current.GetService <ISlidersRepository>();
         Slider             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
 }
コード例 #8
0
 public GetCoinPriceListQueryHandler(IQuotesRepository quotesRepository, IMapper mapper)
 {
     _quotesRepository = quotesRepository ?? throw new ArgumentNullException(nameof(quotesRepository));
     _mapper           = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
コード例 #9
0
 public async Task <DesignQuote> GetDesignQuote(IQuotesRepository quotesRepository)
 {
     return((await quotesRepository.GetAllQuotes()).ElementAt(Utils.GetCurrentDisplayIndex()));
 }
コード例 #10
0
 public QuotesManager(IQuotesRepository repository, IStringLocalizer <Quote> l)
 {
     _repository = repository;
     _l          = l;
 }
コード例 #11
0
		public QuotesManager(IQuotesRepository repository)
		{
			_repository = repository;
		}
コード例 #12
0
 public QuotesController(IQuotesRepository repository)
 {
     this.repository = repository;
 }
コード例 #13
0
        public static List <Quote> GetQuotes()
        {
            IQuotesRepository repository = DependencyResolver.Current.GetService <IQuotesRepository>();

            return(repository.GetList().ToList());
        }
コード例 #14
0
 public CreateQuoteHandler(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #15
0
ファイル: QuotesService.cs プロジェクト: gavin24/BusinessApp
 public QuotesService(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #16
0
        public virtual JsonResult GetEntityList(string table, string field)
        {
            Table t = (Table)Enum.Parse(typeof(Table), table);
            Field f = (Field)Enum.Parse(typeof(Field), field);

            if (t == Table.Articles)
            {
                IArticleRepository repository = DependencyResolver.Current.GetService <IArticleRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Certificates)
            {
                ICertificatesRepository repository = DependencyResolver.Current.GetService <ICertificatesRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Contacts)
            {
                IContactsRepository repository = DependencyResolver.Current.GetService <IContactsRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Images)
            {
                IImagesRepository repository = DependencyResolver.Current.GetService <IImagesRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Languages)
            {
                ILanguagesRepository repository = DependencyResolver.Current.GetService <ILanguagesRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.PortfolioDetails)
            {
                IPortfolioDetailsRepository repository = DependencyResolver.Current.GetService <IPortfolioDetailsRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Portfolios)
            {
                IPortfoliosRepository repository = DependencyResolver.Current.GetService <IPortfoliosRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.ProductCategories)
            {
                IProductCategoriesRepository repository = DependencyResolver.Current.GetService <IProductCategoriesRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Products)
            {
                IProductsRepository repository = DependencyResolver.Current.GetService <IProductsRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Quotes)
            {
                IQuotesRepository repository = DependencyResolver.Current.GetService <IQuotesRepository>();
                if (f == Field.Description)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, Name = x.Description }), JsonRequestBehavior.AllowGet));
                }
            }
            if (t == Table.Sliders)
            {
                ISlidersRepository repository = DependencyResolver.Current.GetService <ISlidersRepository>();
                if (f == Field.Name)
                {
                    return(Json(repository.GetList().Select(x => new { x.Id, x.Name }), JsonRequestBehavior.AllowGet));
                }
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #17
0
 public GetAllQuotesHandler(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #18
0
 public UsersController(IQuotesRepository repo, IMapper mapper)
 {
     _mapper = mapper;
     _repo   = repo;
 }
コード例 #19
0
 public DeleteQuoteHandler(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #20
0
 public GetQuoteByIdHandler(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #21
0
ファイル: HomeController.cs プロジェクト: JohnCaveson/.NET
 public HomeController(IQuotesRepository quotes)
 {
     _quotes = quotes;
 }
コード例 #22
0
 public AddCoinPriceCommandHandler(IQuotesRepository quotesRepository, IMapper mapper, ILogger <AddCoinPriceCommandHandler> logger)
 {
     _quotesRepository = quotesRepository ?? throw new ArgumentNullException(nameof(_quotesRepository));
     _mapper           = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #23
0
 public QuotesController(IQuotesRepository quotesRepository)
 {
     _quotesRepository = quotesRepository;
 }
コード例 #24
0
 public QuotesController(IQuotesRepository repository)
 {
     this.repository = repository;
 }
コード例 #25
0
 public HomeController(ILogger <HomeController> logger, IQuotesRepository repository, QuotesDbContext context)
 {
     _logger     = logger;
     _context    = context;
     _repository = repository;
 }
コード例 #26
0
 public async Task <DesignQuote> GetDesignQuote(IQuotesRepository quotesRepository)
 {
     return(await quotesRepository.GetRandomQuote());
 }