Ejemplo n.º 1
0
        public async Task <ActionResult <GetEventModel> > GetRandomEvent(RandomEventFilter randomEventFilter)
        {
            var uid = new Guid(HttpContext.Request.Headers[AuthorizationHeaders.PersonUid].First());
            var validationResult = _eventValidation.ValidateGetRandomEvent(randomEventFilter);

            if (!validationResult.ValidationResult)
            {
                return(BadRequest(validationResult.ValidationMessage));
            }
            var randomEvent = await _eventLogic.GetRandomEvent(randomEventFilter, uid);

            if (randomEvent == null)
            {
                return(BadRequest(ErrorDictionary.GetErrorMessage(25, CultureParser.GetCultureFromHttpContext(HttpContext))));
            }
            return(randomEvent);
        }