public ActionResult Index(ChallengeChangeViewModel viewModel) { var userName = User.Identity.GetUserName(); _userRepository.RemoveCompletedChallenge(viewModel.Id, userName); return(RedirectToAction("index", "Profile")); }
public ActionResult Index(ChallengeChangeViewModel viewModel) { var userName = User.Identity.GetUserName(); string msg = null; if (_userRepository.AllBooksAreRead(viewModel.Id, userName)) { _userRepository.CompleteChallenge(viewModel.Id, userName); } else { msg = "not-all"; } switch (viewModel.Return) { case "Profile": return(RedirectToAction("Index", viewModel.Return, new { msg = msg })); case "Challenge": return(RedirectToAction("Index", viewModel.Return, new { id = viewModel.Id, msg = msg })); default: return(RedirectToAction("Index", "Home", new { msg = "unknown" })); } }
public ActionResult Index(ChallengeChangeViewModel viewModel) { GetUserRole(); _challengeRepository.Remove(viewModel.Id); return(RedirectToAction("Index", "Home")); }