예제 #1
0
        public async Task <int> GetMarketId(string seourl)
        {
            //todo: gerçek çözüm bul
            if (seourl != "images")
            {
                Markets markets = await _marketRepository.Get(x => x.SeoUrl == seourl);

                return(markets.Id);
            }
            else
            {
                return(0);
            }
        }
        public IActionResult Get(long?tournamentid)
        {
            try
            {
                if (tournamentid.HasValue)
                {
                    _logger.LogInformation("API Request hit: GET all MarketOdds by TournamentId: " + tournamentid.Value);
                    var result = _marketRepository.Get(tournamentid);
                    if (result.ToList().Any())
                    {
                        return(Ok(result));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (GET all MarketOdds by TournamentId: " + tournamentid.Value + " ) no entries found");
                        return(NotFound("MarketOdds were not found with TournamentId: " + tournamentid.Value));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit: GET all MarketOdds by no criteria");
                    var result = _marketRepository.GetAll();
                    return(Ok(result));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (GET all MarketOdds by TournamentId) FAILED: ", e);
                return(BadRequest());
            }
        }
예제 #3
0
        public HttpResponseMessage Get(HttpRequestMessage request, int id)
        {
            var market = _marketRepository.Get(id);

            return(market == null
                ? new HttpResponseMessage(HttpStatusCode.NotFound)
                : request.CreateResponse(HttpStatusCode.OK, market));
        }
예제 #4
0
        public ActionResult Product(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            var product = productRepo.Get(id.Value);

            if (product == null)
            {
                return(HttpNotFound());
            }
            var       market    = marketRepo.Get(product.MarketId);
            ProductVM productVM = new ProductVM(id.Value, product.Name, product.ImageUrl, product.Price, product.PrevPrice,
                                                market.Id, market.Name, market.MarketLogoUrl);

            productVM.IsFavorite   = favProductRepository.IsFavorite(id.Value, User.Identity.Name);
            productVM.Associations = associationRepository.GetAssociations(id.Value);

            return(View(productVM));
        }
예제 #5
0
 public IQueryable <Market> Get()
 {
     return(_marketRepository.Get());
 }