public async Task <IActionResult> Create( TeamRequestV1 payload, ApiVersion version) { var dto = payload.MapCreatedToDto(DateTimeOffset.UtcNow, Guid.NewGuid()); var result = await teamsStore.CreateTeamAsync(dto); return(CreatedAtRoute( nameof(GetOne), new { version = $"{version}", id = result.Id }, result.MapFromDto())); }
public static Team MapCreatedToDto( [DisallowNull] this TeamRequestV1 request, DateTimeOffset created, Guid id) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(new Team { Id = id, Updated = created, Name = request.Name }); }