コード例 #1
0
        public ActionResult OptionTableAjax(QuestionUpdateModel model, string formAction, int?index)
        {
            try
            {
                using (var dataContext = new HuntingEntities())
                {
                    var user = AclUserContext.GetDetail(dataContext, User.Identity.Name);
                    if (user == null)
                    {
                        return(PartialView(@"AjaxError", GlobalRes.ERROR_NOT_ALLOWED));
                    }
                    var questionnaire = QuestionnaireContext.GetDetail(dataContext, model.QuestionnaireId);
                    if (questionnaire == null)
                    {
                        return(PartialView(@"AjaxError", GlobalRes.ERROR_NOT_FOUND));
                    }
                    if (user.CanUpdateTerritory(questionnaire.MapItemType.Territory) == false)
                    {
                        return(PartialView(@"AjaxError", GlobalRes.ERROR_NOT_ALLOWED));
                    }

                    QuestionContext.OptionTableAction(dataContext, model, formAction, index);
                    ModelState.Clear();
                    return(PartialView("~/Views/Question/CommonLayout/OptionList.cshtml", model));
                }
            }
            catch (Exception exception)
            {
                logger.Error(exception, "QuestionController");
                return(PartialView(@"AjaxError", GlobalRes.ERROR_EXCEPTION));
            }
        }