public HttpResponseMessage SoftDelete(JournalIdDTO postData) { try { var jc = JournalController.Instance; var ji = jc.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); if (ji == null) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "invalide request")); } if (ji.UserId == UserInfo.UserID || UserInfo.IsInRole(PortalSettings.AdministratorRoleName)) { jc.SoftDeleteJournalItem(PortalSettings.PortalId, UserInfo.UserID, postData.JournalId); return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" })); } return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "access denied")); } catch (Exception exc) { Logger.Error(exc); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)); } }
public HttpResponseMessage Like(JournalIdDTO postData) { try { JournalController.Instance.LikeJournalItem(postData.JournalId, UserInfo.UserID, UserInfo.DisplayName); var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo); var isLiked = false; var likeList = jp.GetLikeListHTML(ji, ref isLiked); likeList = Utilities.LocalizeControl(likeList); return(Request.CreateResponse(HttpStatusCode.OK, new { LikeList = likeList, Liked = isLiked })); } catch (Exception exc) { Logger.Error(exc); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)); } }
public HttpResponseMessage Like(JournalIdDTO postData) { try { JournalController.Instance.LikeJournalItem(postData.JournalId, UserInfo.UserID, UserInfo.DisplayName); var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo); var isLiked = false; var likeList = jp.GetLikeListHTML(ji, ref isLiked); likeList = Utilities.LocalizeControl(likeList); return Request.CreateResponse(HttpStatusCode.OK, new { LikeList = likeList, Liked = isLiked }); } catch (Exception exc) { Logger.Error(exc); return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } }
public HttpResponseMessage SoftDelete(JournalIdDTO postData) { try { var jc = JournalController.Instance; var ji = jc.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); if (ji == null) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "invalide request"); } if (ji.UserId == UserInfo.UserID || UserInfo.IsInRole(PortalSettings.AdministratorRoleName)) { jc.SoftDeleteJournalItem(PortalSettings.PortalId, UserInfo.UserID, postData.JournalId); return Request.CreateResponse(HttpStatusCode.OK, new {Result = "success"}); } return Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "access denied"); } catch (Exception exc) { Logger.Error(exc); return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } }