Beispiel #1
0
        /// <summary>
        /// Get a list of Bands
        /// </summary>
        /// <remarks>Return a list of Bands</remarks>
        /// <response code="404">Not Found</response>
        /// <response code="200">Ok</response>
        /// <returns>List of Bands</returns>
        public override IHttpActionResult Get()
        {
            IEnumerable <Band> bands = _repository.Select();

            if (!bands.Any())
            {
                return(Content(HttpStatusCode.NotFound, new { message = "The response didn't return any data.", status = HttpStatusCode.NotFound }));
            }

            List <BandDTO> dtos = _autoMapper.Map <List <Band>, List <BandDTO> >(bands.ToList());

            return(Ok(dtos));
        }