示例#1
0
        private static IList<Attachment> ParseAttachments(HttpRequestBase request)
        {
            var count = request.AsInt("attachments");
            var info = request.AsJson("attachment-info");

            var attachments = new List<Attachment>();

            for (int i = 1; i <= count; i++)
            {
                var item = info["attachment" + i];

                attachments.Add(new Attachment
                {
                    Type = item.type,
                    Name = item.name,
                    FileName = item.filename,
                    Content = request.Files["attachment" + i]
                });
            }

            return attachments;
        }