示例#1
0
 //download
 public AttachmentItemDownloadModel DownloadAttachmentItem(AttachmentItemKeyModel model)
 {
     if (!_authorization.Download(model))
     {
         throw new UnauthorizedAccessException();
     }
     return(_business.DownloadAttachmentItem(model));
 }
        public ActionResult Download(AttachmentItemKeyModel model)
        {
            try
            {
                var item = attachmentBusiness.DownloadAttachmentItem(model);//check download permission
                if (item == null)
                {
                    return(NotFound());
                }

                return(File(item.FileContent, item.FileExtension, item.FileName));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }