public async Task <ActionResult> View(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)); } var posts = await _privateMessageService.GetPosts(pm); var model = new PrivateMessageView { PrivateMessage = pm, Posts = posts }; await _privateMessageService.MarkPMRead(user, pm); return(View(model)); }
public ViewResult View(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)); } var model = new PrivateMessageView { PrivateMessage = pm, Posts = _privateMessageService.GetPosts(pm) }; _privateMessageService.MarkPMRead(user, pm); return(View(model)); }
public ActionResult View(int id) { var user = _userRetrievalShim.GetUser(HttpContext); if (user == null) { return(Forbid()); } var pm = _privateMessageService.Get(id); if (!_privateMessageService.IsUserInPM(user, pm)) { return(Forbid()); } var model = new PrivateMessageView { PrivateMessage = pm, Posts = _privateMessageService.GetPosts(pm) }; _privateMessageService.MarkPMRead(user, pm); return(View(model)); }