public async Task <IEnumerable <PersonResource> > Get() { _logger.LogInformation("In front-end"); var httpClient = new HttpClient(); var client = new api.clients.PersonApiClient("https://localhost:5007", httpClient); var people = await client.PersonAllAsync(); return(people.Select(x => new PersonResource { EmailAddress = x.EmailAddress, FirstName = x.FirstName, Id = x.Id, LastName = x.LastName, Password = x.Password }) .ToArray()); }
public async Task <PersonResource> Post([FromBody] PersonResource person) { _logger.LogInformation("In front-end"); var httpClient = new HttpClient(); var client = new api.clients.PersonApiClient("https://localhost:5007", httpClient); var toSave = new Person { EmailAddress = person.EmailAddress, FirstName = person.FirstName, LastName = person.LastName, Password = person.Password }; var result = await client.PersonAsync(toSave); return(new PersonResource { EmailAddress = result.EmailAddress, FirstName = result.FirstName, LastName = result.LastName, Password = result.Password }); }