public ActionResult Move(int id, bool isMoveUp) { 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 question = QuestionContext.GetDetail(dataContext, id); if (question == null) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, GlobalRes.ERROR_NOT_FOUND); return(RedirectToAction("Index", "Home")); } if (user.CanUpdateTerritory(question.Questionnaire.MapItemType.Territory) == false) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, GlobalRes.ERROR_NOT_ALLOWED); return(RedirectToAction("Index", "Territory", new { id = question.Questionnaire.MapItemType.TerritoryId })); } var isSuccess = QuestionContext.Move(dataContext, question.Questionnaire, question.Id, isMoveUp, user); if (isSuccess == false) { ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Warning, QuestionRes.ERROR_MOVE); } return(RedirectToAction("Index", "Question", new { id = question.QuestionnaireId })); } } catch (Exception exception) { logger.Error(exception, "QuestionController"); ContextUtils.CreateActionStateCookie(Response, ActionTypeEnum.Danger, GlobalRes.ERROR_EXCEPTION); return(RedirectToAction("Index", "Home")); } }