Exemplo n.º 1
0
        public IActionResult Favourites([FromBody] UserRequest favourite)
        {
            try
            {
                if (string.IsNullOrEmpty(favourite.UserId) && string.IsNullOrWhiteSpace(favourite.UserId))
                {
                    return(StatusCode(StatusCodes.Status400BadRequest, Constants.InputInvalid));
                }

                var favList = _weatherService.Favourites(favourite.UserId);
                if (favList != null && favList.Count() > 0)
                {
                    return(Ok(favList));
                }

                return(StatusCode(StatusCodes.Status204NoContent, Constants.NoResultsFound));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }