Пример #1
0
        public ActionResult <ContactReadDto> CreateContact(ContactCreateDto contactCreateDto)
        {
            var contactModel = _mapper.Map <Contact>(contactCreateDto);

            _repository.CreateContact(contactModel);
            _repository.SaveChanges();

            var contactReadDto = _mapper.Map <ContactReadDto>(contactModel);

            return(CreatedAtRoute(nameof(GetContactById), new { Id = contactReadDto.Id }, contactReadDto));
        }