public static ServiceUserDomain ToDomain(this ServiceUserRequest serviceUserEntity) { return(new ServiceUserDomain { Id = serviceUserEntity.Id, FirstName = serviceUserEntity.FirstName, MiddleName = serviceUserEntity.MiddleName, LastName = serviceUserEntity.LastName, DateOfBirth = serviceUserEntity.DateOfBirth, HackneyId = serviceUserEntity.HackneyId, AddressLine1 = serviceUserEntity.AddressLine1, AddressLine2 = serviceUserEntity.AddressLine2, AddressLine3 = serviceUserEntity.AddressLine3, Town = serviceUserEntity.Town, County = serviceUserEntity.County, PostCode = serviceUserEntity.PostCode, DateCreated = serviceUserEntity.DateCreated, DateUpdated = serviceUserEntity.DateUpdated }); }
public async Task <ActionResult <ServiceUserResponse> > Create(ServiceUserRequest serviceUserRequest) { try { var usersDomain = serviceUserRequest.ToDomain(); var res = await _upsertClientsUseCase.ExecuteAsync(usersDomain) .ConfigureAwait(false); var clientsResponse = res.ToResponse(); if (clientsResponse == null) { return(NotFound()); } return(Ok(clientsResponse)); } catch (FormatException ex) { return(BadRequest(ex.Message)); } }