public async Task <IActionResult> Create([FromBody] CreatePersonRequest request) { var result = await _dispatcher.DispatchCommandAsync(new CreatePerson( PersonId.NewId(), new Name(request.FirstName, request.LastName))); return(Ok(result)); }
/// <summary> /// Create a new person /// </summary> /// <param name="firstName">Person's first name</param> /// <param name="lastName">Person's last name</param> /// <param name="birthDate">Person's birth date</param> /// <subject>person</subject> /// <action>create</action> public CreatePerson(string firstName, string lastName, DateTime birthDate) { Id = PersonId.NewId(); Name = new Name(firstName, lastName); BirthDate = birthDate; }