Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Sort Main Id</param>
        /// <returns></returns>
        public ActionResult GetAttachments(int?id)
        {
            var model = new List <SortAttachmentObject>();

            if (id.HasValue && SortMainObject.CheckUserHasReadAccess(id.Value))
            {
                model = SortAttachmentObject.GetSortAttachments(id.Value);
            }

            return(PartialView("Partials/_attachmentList", model));
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Sort Attachment Id</param>
        /// <returns></returns>
        public FileResult DownloadAttachment(int?id)
        {
            if (id.HasValue)
            {
                SortAttachmentObject aa = SortAttachmentObject.GetSortAttachment(id.Value);
                if (aa != null && SortMainObject.CheckUserHasReadAccess(aa.SortMainId))
                {
                    var content = aa.Contents;
                    if (content != null)
                    {
                        content.Seek(0, SeekOrigin.Begin);
                        // Need this turned off for large files
                        Response.BufferOutput = false;
                        return(File(content, System.Net.Mime.MediaTypeNames.Application.Octet, aa.FileName));
                    }
                }
            }

            return(null);
        }