public HttpResponseMessage GetTotals()
        {
            try
            {
                var portalId = PortalController.GetEffectivePortalId(UserController.Instance.GetCurrentUserInfo().PortalID);
                var totalsViewModel = new TotalsViewModel
                {
                    TotalUnreadMessages = InternalMessagingController.Instance.CountUnreadMessages(UserInfo.UserID, portalId),
                    TotalNotifications = NotificationsController.Instance.CountNotifications(UserInfo.UserID, portalId)
                };

                return Request.CreateResponse(HttpStatusCode.OK, totalsViewModel);
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
            }
        }
예제 #2
0
        public ActionResult GetTotals()
        {
            try
            {
                var portalId = PortalController.GetEffectivePortalId(UserController.GetCurrentUserInfo().PortalID);
                var totalsViewModel = new TotalsViewModel
                {
                    TotalUnreadMessages = InternalMessagingController.Instance.CountUnreadMessages(UserInfo.UserID, portalId),
                    TotalNotifications = NotificationsController.Instance.CountNotifications(UserInfo.UserID, portalId)
                };

                return Json(totalsViewModel, JsonRequestBehavior.AllowGet);
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
                return Json(null, JsonRequestBehavior.AllowGet);
            }
        }