Пример #1
0
        private async Task SaveRegiXResponse(long requestId, RegiXResponse rawResponse, string errors)
        {
            RegiXrequest request = await _context.RegiXrequest
                                   .Where(x => x.Id == requestId)
                                   .FirstOrDefaultAsync();

            if (request == null)
            {
                throw new Exception("No request found for response!");
            }

            request.AnsweredAtUtc = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
            request.Errors        = errors;

            RegiXresponse response = new RegiXresponse
            {
                RequestId  = requestId,
                RawContent = rawResponse.RawResponse.MessageContent
            };

            _context.RegiXrequest.Update(request);
            await _context.RegiXresponse.AddAsync(response);

            await _context.SaveChangesAsync();
        }
Пример #2
0
        private async Task <long> SaveRegiXRequest(ServiceRequestData request, RegiXReportModel report)
        {
            RegiXrequest entity = new RegiXrequest
            {
                UserId        = null,
                RegiXreportId = report.Id,
                Argument      = request.Argument.OuterXml,
                CreatedAtUtc  = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc)
            };

            await _context.RegiXrequest.AddAsync(entity);

            await _context.SaveChangesAsync();

            long requestId = entity.Id;

            return(requestId);
        }