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 ActionResult CommentLike(int journalId, int commentId) { try { InternalJournalController.Instance.LikeComment(journalId, commentId, UserInfo.UserID, UserInfo.DisplayName); var ji = JournalController.Instance.GetJournalItem(PortalSettings.PortalId, UserInfo.UserID, 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(Json(new { LikeList = likeList, Liked = isLiked }, JsonRequestBehavior.AllowGet)); } catch (Exception exc) { DnnLog.Error(exc); return(Json(new { Result = "error" })); } }