public ActionResult EditQuestion(int id) { if (User.Identity.IsAuthenticated && User.IsInRole("Admin")) { Question question = RatingManager.GetQuestionById(id); return(View(question)); } return(RedirectToAction("Index", "Home")); }
public ActionResult RemoveQuestion(int id) { if (User.Identity.IsAuthenticated && User.IsInRole("Admin")) { return(View(new RemoveQuestionViewModel { Id = id, Value = RatingManager.GetQuestionById(id).Value })); } return(RedirectToAction("Index", "Home")); }
public ActionResult RemoveQuestion(RemoveQuestionViewModel model) { if (User.Identity.IsAuthenticated && User.IsInRole("Admin")) { if (RatingManager.GetQuestionById(model.Id) != null) { RatingManager.RemoveQuestion(model.Id); //Видалення всіх відповідей } return(RedirectToAction("Questions", "Admin")); } return(RedirectToAction("Index", "Home")); }