Exemple #1
0
        public async Task <ActionResult> PostAsync([FromBody, Required] ContactDto contactDto)
        {
            var contact = new Contact
            {
                FirstName   = contactDto.FirstName,
                LastName    = contactDto.LastName,
                DateOfBirth = DateTime.ParseExact(contactDto.DateOfBirth, "yyyy-MM-dd", CultureInfo.InvariantCulture)
            };

            await _aggregateStore.AddAsync(contact);

            return(Created($"{Request.Scheme}://{Request.Host}/contacts/{contact.ID}", null));
        }