Ejemplo n.º 1
0
        public DogResponse CreateWithImages(CreateWithImagesRequest model)
        {
            // map model to new dog object
            var dog = _mapper.Map <Dog>(model);

            dog.Created = DateTime.UtcNow;

            // save dog
            _context.Dogs.Add(dog);
            _context.SaveChanges();

            return(_mapper.Map <DogResponse>(dog));
        }
Ejemplo n.º 2
0
        public ActionResult <DogResponse> CreateWithImages([FromForm] CreateWithImagesRequest model)
        {
            var dog = _dogService.CreateWithImages(model);

            return(Ok(dog));
        }