public JsonResult UpdateQuestionType(QuestionType questionType)
        {
            JsonResult result = new JsonResult();
            string     msg    = "";

            try
            {
                questionType.ModifiedTime = DateTime.Now;
                questionType.Modifier     = (Session["user"] as SYS_User)?.UserName;
                bool isSuccess = questionTypeService.UpdateQuestionType(questionType);
                if (isSuccess)
                {
                    msg = "修改成功";
                }
                else
                {
                    msg = "修改失败";
                }
                log.Info(msg);
            }
            catch (DbEntityValidationException e)
            {
                log.Error(e.Message);
            }
            catch (Exception e)
            {
                log.Error(e.Message);
            }
            finally
            {
                result = Json(new { msg = msg }, JsonRequestBehavior.AllowGet);
            }
            return(result);
        }
Exemple #2
0
        public JsonResult <APIResultEntities <bool> > Put(Guid id, QuestionTypeEntities entity)
        {
            APIResultEntities <bool> rs = new APIResultEntities <bool>();

            try
            {
                _iQuestionTypeService.UpdateQuestionType(id, entity);
                rs.Data           = true;
                rs.ErrCode        = ErrorCodeEntites.Success;
                rs.ErrDescription = string.Format(Constants.MSG_UPDATE_SUCCESS, Constants.QuestionType);
            }
            catch (Exception ex)
            {
                rs.Data           = false;
                rs.ErrCode        = ErrorCodeEntites.Fail;
                rs.ErrDescription = ex.ToString();
            }
            return(Json(rs));
        }