Exemplo n.º 1
0
        public IActionResult GetOne([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id == 0) // Wenn id ist zero, find the only active salon
            {
                try
                {
                    id = salonRepository.GetFirstId();
                }
                catch (Exception ex)
                {
                    log.LogError("[GET: api/Salon/{0}] {1}", id, ex.Message);
                    return(NoContent());
                };
            }

            var salon = salonRepository.GetOne(id);

            if (salon == null)
            {
                return(NoContent());
            }

            return(Ok(salon));
        }