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()); } }
public int?Add(DogView dogView) { Dog dog = _mapper.Map <DogView, Dog>(dogView); return(_repository.Add(dog)); }