public IHttpActionResult Download() { try { var request = new AuthenticatedRequest(); var siteId = request.GetPostInt("siteId"); var specialId = request.GetPostInt("specialId"); if (!request.IsAdminLoggin || !request.AdminPermissionsImpl.HasSitePermissions(siteId, ConfigManager.SitePermissions.Specials)) { return(Unauthorized()); } var siteInfo = SiteManager.GetSiteInfo(siteId); var specialInfo = SpecialManager.GetSpecialInfo(siteId, specialId); var directoryPath = SpecialManager.GetSpecialDirectoryPath(siteInfo, specialInfo.Url); var srcDirectoryPath = SpecialManager.GetSpecialSrcDirectoryPath(directoryPath); var zipFilePath = SpecialManager.GetSpecialZipFilePath(specialInfo.Title, directoryPath); FileUtils.DeleteFileIfExists(zipFilePath); ZipUtils.CreateZip(zipFilePath, srcDirectoryPath); var url = SpecialManager.GetSpecialZipFileUrl(siteInfo, specialInfo); return(Ok(new { Value = url })); } catch (Exception ex) { return(InternalServerError(ex)); } }