Ejemplo n.º 1
0
        public IActionResult Add([FromBody] DogView dogView)
        {
            if (string.IsNullOrWhiteSpace(dogView.Name) || dogView.Age < 0)
            {
                return(BadRequest());
            }

            int?result = _dogDomain.Add(dogView);

            if (result.HasValue)
            {
                dogView.Id = result.Value;
                return(Ok(dogView));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 2
0
        public int?Add(DogView dogView)
        {
            Dog dog = _mapper.Map <DogView, Dog>(dogView);

            return(_repository.Add(dog));
        }