public IActionResult GetSearchEngineView() { SearchEngineModel searchEngineModel = new SearchEngineModel(); searchEngineModel.ArticleCategoryList = _repositoryWrapper.ArticlesCategory .FindAll().ToList(); return(View("Search", searchEngineModel)); }
public IActionResult Index(AuctionViewModel newAuction) { var auction = new SearchEngineModel { Id = Guid.NewGuid().GetHashCode(), CategoryString = newAuction.Category == null?"": newAuction.Category.ToString(), DateAdded = newAuction.DateAdded, Description = newAuction.Description, PhoneNumber = newAuction.PhoneNumber, Title = newAuction.Title, User = GetLoggedUser().Email }; var indexResponse = _client.Index(auction, i => i.Index("auctions")); //var indexResponse = _client.IndexDocument(auction); if (ModelState.IsValid && indexResponse.IsValid) { _context.Database.EnsureCreated(); newAuction.User = GetLoggedUser(); InsertAuction(newAuction); return(RedirectToAction("Index", "Home")); } return(View()); }