示例#1
0
        public ActionResult DeletionRequests()
        {
            var userId           = User.Identity.GetUserId();
            var deletionRequests = _deletionRequestRepository.Find(d => d.UserId == userId).ToList();

            return(View(deletionRequests));
        }
        public ActionResult CloseRequest(int id)
        {
            var request = _requestRepository.Find(r => r.RequestId == id).FirstOrDefault();

            var adminResponse   = Request.Params["reason"];
            var requestDecision = Request.Params["decision"];

            if (requestDecision == "Yes")
            {
                request.RequestAccepted = true;
            }

            request.RequestClosed = true;
            request.AdminResponse = adminResponse;
            request.AdminUserId   = User.Identity.GetUserId();

            var userNotification        = CreateUserNotification(request);
            var createNotificationModel = new BLLUserNotificationTypes(userNotification, _unitOfWork);

            createNotificationModel.CreateUserNotification();

            //want to move this out into a deletionRequest class
            _unitOfWork.DeletionRequests.Update(request);
            _unitOfWork.Complete();

            if (requestDecision == "Yes")
            {
                return(RedirectToAction("Delete", "Feed", new { feedId = request.FeedId, requestId = request.RequestId }));
            }

            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Requests");

            return(Json(new { Url = redirectUrl }));
        }