NuSurvey.Web.Controllers.SurveyResponseController.DeletePending C# (CSharp) Method

DeletePending() public method

#8 GET:
public DeletePending ( int id, bool fromAdmin ) : System.Web.Mvc.ActionResult
id int SurveyResponse Id
fromAdmin bool
return System.Web.Mvc.ActionResult
        public ActionResult DeletePending(int id, bool fromAdmin)
        {
            var surveyResponse = _surveyResponseRepository.GetNullableById(id);
            if (surveyResponse == null || !surveyResponse.IsPending)
            {
                Message = "Pending survey not found";
                return this.RedirectToAction<ErrorController>(a => a.Index());
            }
            if (!CurrentUser.IsInRole(RoleNames.Admin) && surveyResponse.UserId.ToLower() != CurrentUser.Identity.Name.ToLower())
            {
                Message = "Not your survey";
                return this.RedirectToAction<ErrorController>(a => a.NotAuthorized());
            }
            var viewModel = SingleAnswerSurveyResponseViewModel.Create(Repository, surveyResponse.Survey, surveyResponse);
            viewModel.FromAdmin = fromAdmin;

            return View(viewModel);
        }

Same methods

SurveyResponseController::DeletePending ( int id, bool confirm, bool fromAdmin ) : System.Web.Mvc.ActionResult