Beispiel #1
0
        public ActionResult ArchivePM(int id)
        {
            var user = _userRetrievalShim.GetUser(HttpContext);

            if (user == null)
            {
                return(Forbid());
            }
            var pm = _privateMessageService.Get(id);

            if (!_privateMessageService.IsUserInPM(user, pm))
            {
                return(Forbid());
            }
            _privateMessageService.Archive(user, pm);
            return(RedirectToAction("Index"));
        }
        public ActionResult ArchivePM(int id)
        {
            var user = this.CurrentUser();

            if (user == null)
            {
                return(this.Forbidden("Forbidden", null));
            }
            var pm = _privateMessageService.Get(id);

            if (!_privateMessageService.IsUserInPM(user, pm))
            {
                return(this.Forbidden("Forbidden", null));
            }
            _privateMessageService.Archive(user, pm);
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> ArchivePM(int id)
        {
            var user = _userRetrievalShim.GetUser();

            if (user == null)
            {
                return(StatusCode(403));
            }
            var pm = await _privateMessageService.Get(id);

            if (await _privateMessageService.IsUserInPM(user, pm) == false)
            {
                return(StatusCode(403));
            }
            await _privateMessageService.Archive(user, pm);

            return(RedirectToAction("Index"));
        }