// GET: Questionnaire/id public ActionResult Index(int id) { try { using (var dataContext = new HuntingEntities()) { var user = AclUserContext.GetDetail(dataContext, User.Identity.Name); if (user == null) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, GlobalRes.ERROR_NOT_ALLOWED); return(RedirectToAction("Index", "Home")); } var mapItemType = MapItemTypeContext.GetDetail(dataContext, id); if (mapItemType == null) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, GlobalRes.ERROR_NOT_FOUND); return(RedirectToAction("Index", "Home")); } if (user.CanUpdateTerritory(mapItemType.Territory) == false) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, GlobalRes.ERROR_NOT_ALLOWED); return(RedirectToAction("Index", "Territory", new { id = mapItemType.TerritoryId })); } var itemList = QuestionnaireContext.GetList(dataContext, mapItemType); var model = new QuestionnaireListModel(mapItemType, itemList); return(View(model)); } } catch (Exception exception) { logger.Error(exception, "QuestionnaireController"); ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Danger, GlobalRes.ERROR_EXCEPTION); return(RedirectToAction("Index", "Home")); } }