Exemplo n.º 1
0
        public async Task <ActionResult> Delete(int noticeId)
        {
            using (NoticeManager nm = new NoticeManager())
            {
                var postedBy = await nm.PostedBy(noticeId);

                var current = await User.Identity.GetApplicationUserAsync();

                var notice = await nm.GetAsync(noticeId);

                if ((postedBy.Id == current.Id && notice.IsPendingApproval) ||
                    await User.Identity.IsModeratorAsync())
                {
                    var res = await nm.DeleteAsync(noticeId);

                    //if (res > 0) ;
                    //  return Json(JsonViewModel.Success);
                }
            }
            // return Json(JsonViewModel.Error);
            return(RedirectToAction("Index", "Home"));
        }