Beispiel #1
0
        public JsonResult Edit(ArticleTypeVModel model)
        {
            var result = new JsonResultModel();

            if (ModelState.IsValid)
            {
                //edit user
                result.ResultState = ArticleTypes.UpdateArticleType(ArticleTypes.ArticleTypeVModelToInfo(model)) > 0;
            }
            else
            {
                result.ResultState = false;
                result.Message     = ModelStateHelper.GetAllErrorMessage(ModelState);
            }

            return(Json(result));
        }
Beispiel #2
0
        public JsonResult Add(ArticleTypeVModel model)
        {
            var result = new JsonResultModel();

            if (ModelState.IsValid)
            {
                model.PinYin = PinYinHelper.ConvertToPinYin(model.Name);

                //add
                result.ResultState = ArticleTypes.AddArticleType(ArticleTypes.ArticleTypeVModelToInfo(model)) > 0;
            }
            else
            {
                result.ResultState = false;
                result.Message     = ModelStateHelper.GetAllErrorMessage(ModelState);
            }

            return(Json(result));
        }