Ejemplo n.º 1
0
        public IActionResult GetBonusHistory([FromQuery] int skip)
        {
            try
            {
                var userId = Convert.ToInt32(User.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value);

                IList <BonusIncomeType> bonusTypes = new List <BonusIncomeType>();
                var history = _bonusService.BonusHistory(userId, out bonusTypes, skip, 3);

                return(Ok(new
                {
                    History = _mapper.Map <BonusIncomeDto[]>(history),
                    Types = bonusTypes
                }));
            }
            catch (AppException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogCritical($"{ex}");
                return(BadRequest("Service error!"));
            }
        }