Exemplo n.º 1
0
        public async Task <IActionResult> BetEdit(int id)
        {
            var findBet = await betRepository.FindBet(id);

            if (!findBet)
            {
                return(View("Error", $"Bet with id: {id} does not exist in database!"));
            }

            var betResource = await betRepository.GetBet(id);

            ViewBag.Currency = await currencyRepository.GetCurrency();

            return(PartialView("_EditBet", betResource));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetBet(int betId)
        {
            try
            {
                var bet = await _betRepository.GetBet(betId);

                if (bet == null)
                {
                    return(NotFound());
                }

                var betDto = Mapper.Map <BetDto>(bet);

                return(Ok(betDto));
            }
            catch (Exception)
            {
                return(GetErrorStatusCodeAndGenericMessage());
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetBet(int id)
        {
            var bet = await betRepository.GetBet(id);

            if (bet == null)
            {
                return(NotFound());
            }

            return(Ok(bet));
        }