public IHttpActionResult GetConfig() { try { var request = Context.GetCurrentRequest(); var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId)) { return(Unauthorized()); } var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetQueryString("contentIds")); var dataInfoList = new List <DataInfo>(); foreach (var contentId in contentIdList) { var contentInfo = DataDao.GetDataInfo(contentId); if (contentInfo == null) { continue; } dataInfoList.Add(contentInfo); } return(Ok(new { Value = dataInfoList })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Get() { try { var request = Context.GetCurrentRequest(); var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId)) { return(Unauthorized()); } var dataId = request.GetQueryInt("dataId"); var dataInfo = DataDao.GetDataInfo(dataId); var fileInfoList = new List <FileInfo>(); if (dataInfo.IsReplyFiles) { fileInfoList = FileDao.GetFileInfoList(siteId, dataId); } var logInfoList = LogDao.GetLogInfoList(siteId, dataId); var settings = ApplicationUtils.GetSettings(siteId); return(Ok(new { Value = dataInfo, LogInfoList = logInfoList, FileInfoList = fileInfoList, Settings = settings })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult GetConfig(int contentId) { try { var request = Context.GetCurrentRequest(); var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId)) { return(Unauthorized()); } var contentInfo = DataDao.GetDataInfo(contentId); if (contentInfo == null || contentInfo.State != DataState.Accepted.Value && contentInfo.State != DataState.Redo.Value && contentInfo.State != DataState.Replied.Value) { return(NotFound()); } var fileInfoList = new List <FileInfo>(); if (contentInfo.IsReplyFiles) { fileInfoList = FileDao.GetFileInfoList(siteId, contentId); } return(Ok(new { Value = contentInfo, FileInfoList = fileInfoList })); } catch (Exception ex) { return(InternalServerError(ex)); } }