Esempio n. 1
0
        public DnsRequestTransaction EditRequestPost(IDnsRequestContext request, IDnsPostContext post)
        {
            var m       = post.GetModel <Medical.Models.MedicalRequestModel>();
            var sqlText = GenerateSqlQuery(m);

            if (string.IsNullOrEmpty(sqlText))
            {
                return(DnsRequestTransaction.Failed("Failed to create the SQL Query"));
            }

            var sqlTextBytes = Encoding.UTF8.GetBytes(sqlText);
            var doc          = Dns.Document("SQL Text", "text/plain", () => new MemoryStream(sqlTextBytes), () => sqlTextBytes.Length);
            var existingDoc  = request.Documents.FirstOrDefault();

            return(new DnsRequestTransaction
            {
                NewDocuments = existingDoc != null ? null : new[] { doc },
                UpdateDocuments = existingDoc == null ? null :
                                  new[] { new { existingDoc, doc } }.ToDictionary(x => x.existingDoc, x => x.doc),
                RemoveDocuments = request.Documents.Skip(1)
            });
        }
 public DnsRequestTransaction EditRequestPost(IDnsRequestContext request, IDnsPostContext post)
 {
     return(DnsRequestTransaction.Failed(MissingMessage));
 }