public static async Task WriteToBodyWiter(HttpResponse response, IResponseWriterRepository responseWriterRepository, int accountNumber) { response.Headers.Add("Content-Type", "application/json"); response.StatusCode = 200; await response.StartAsync(); var pipeWriter = response.BodyWriter; pipeWriter.Write(ResponseExtensions.StartObject.Span); pipeWriter.WriteProperty(ResponseExtensions.AccountName, accountNumber); pipeWriter.Write(ResponseExtensions.Comma.Span); pipeWriter.Write(ResponseExtensions.BalanceName.Span); await responseWriterRepository.WriteBalance(accountNumber, response.BodyWriter); pipeWriter.Write(ResponseExtensions.Comma.Span); pipeWriter.Write(ResponseExtensions.OrdersName.Span); await responseWriterRepository.WriteOrders(accountNumber, response.BodyWriter); pipeWriter.Write(ResponseExtensions.EndObject.Span); await pipeWriter.CompleteAsync(); }
public AccountSummaryController( IJsonNETRepository jsonNETRepository, ISystemTextJsonRepository systemTextJsonRepository, IByteArrayRepository byteArrayRepository, IResponseWriterRepository responseWriterRepository) { _jsonNETRepository = jsonNETRepository; _systemTextJsonRepository = systemTextJsonRepository; _byteArrayRepository = byteArrayRepository; _responseWriterRepository = responseWriterRepository; }