BetterCms.Module.MediaManager.Controllers.FilesController.Download C# (CSharp) Метод

Download() публичный Метод

Downloads the specified id.
404;Page Not Found
public Download ( string id ) : System.Web.Mvc.ActionResult
id string The id.
Результат System.Web.Mvc.ActionResult
        public ActionResult Download(string id)
        {
            var model = GetCommand<DownloadFileCommand>().ExecuteCommand(id.ToGuidOrDefault());
            if (model != null)
            {
                if (model.HasNoAccess)
                {
                    throw new HttpException(403, "403 Access Forbidden");
                }

                if (!string.IsNullOrWhiteSpace(model.RedirectUrl))
                {
                    return Redirect(model.RedirectUrl);
                }

                model.FileStream.Position = 0;
                return File(model.FileStream, model.ContentMimeType, model.FileDownloadName);
            }

            throw new HttpException(404, "Page Not Found");
        }