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");
}