public SearchController( ISearchService searchService, ISolrService solrService, ILogger <SearchController> logger ) { _searchService = searchService; _solrService = solrService; _logger = logger; }
public static void ReadSampleData(BookContext context, ISolrService solrService) { Assembly assembly = Assembly.GetExecutingAssembly(); string resourceName = "BookListing.DataAccess.SampleData.books.csv"; using (var stream = assembly.GetManifestResourceStream(resourceName)) { if (!context.Books.Any()) { var authorList = new List <Author>(); var solrIndexList = new List <Book>(); var counter = 0; foreach (var line in CsvReader.ReadFromStream(stream)) { var book = new Book(); book.BookNum = Int32.TryParse(line[0], out int bookNum) ? bookNum : 0; book.Title = line[1]; book.AverageRating = decimal.TryParse(line[3], out decimal rating) ? rating : 0; book.ISBN = line[4]; book.ISBN13 = line[5]; book.LanguageCode = line[6]; book.Pages = Int32.TryParse(line[7], out int pages) ? pages : 0; book.RatingsCount = Int32.TryParse(line[8], out int ratingCount) ? ratingCount : 0; book.ReviewCount = Int32.TryParse(line[9], out int reviews) ? reviews : 0; var authorName = line[2]; var author = context.Authors.SingleOrDefault(m => m.Name.ToLower() == authorName.ToLower()); if (author == null) { author = authorList.SingleOrDefault(m => m.Name.ToLower() == authorName.ToLower()); if (author == null) { author = new Author { Name = authorName }; authorList.Add(author); context.Authors.Add(author); } } book.Author = author; solrIndexList.Add(book); context.Books.Add(book); counter++; if (counter % 300 == 0) { context.SaveChanges(); solrService.IndexBooks(solrIndexList); solrIndexList.Clear(); } } } } }
public TodosController( ITodoItemService todoItemService, IRabbitMQService rabbitMQService, ISolrService solrService, IOptions <TodoSettings> config, IHostingEnvironment env, IHttpClientFactory clientFactory) { _todoItemService = todoItemService; _rabbitMQService = rabbitMQService; _solrService = solrService; _config = config; _env = env; _clientFactory = clientFactory; }
public BookController(BookContext context, ISolrService solrService) { SolrService = solrService; Context = context; }
public IcecatFacade(Iicecat icecat, IDataAccessLayer dal, ISolrService <SolrResponse> solrService) { this._icecat = icecat; this._dal = dal; this._solrService = solrService; }
public ShopController(ISolrService <SolrResponse> searchService) { _searchService = searchService; }
public static void AddSampleData(BookContext context, ISolrService solrService, IUserService userService) { ReadSampleData(context, solrService); AddSampleUsers(context, userService); }
public HangfireService(IFacade ifc, ISolrService <SolrResponse> solr, IOrderService <Order, CheckOutForm> orderService) { _ifc = ifc; _solr = solr; _orderService = orderService; }