Exemple #1
0
        public ActionResult <UsaStateReadDto> CreateUsaState(UsaStateCreateDto req)
        {
            var usastatesModel = _mapper.Map <UsaState>(req);

            _repository.CreateUsaState(usastatesModel);
            _repository.SaveChanges();

            var usastatesReadDto = _mapper.Map <UsaStateReadDto>(usastatesModel);

            return(CreatedAtRoute(nameof(GetUsaStateById), new { Id = usastatesReadDto.Id }, usastatesReadDto));
        }