Exemple #1
0
        public JsonResult <APIResultEntities <QuestionTypeEntities> > Get(Guid id)
        {
            APIResultEntities <QuestionTypeEntities> rs = new APIResultEntities <QuestionTypeEntities>();

            try
            {
                var data = _iQuestionTypeService.GetQuestionTypeById(id);
                if (data != null)
                {
                    rs.Data           = data;
                    rs.ErrCode        = ErrorCodeEntites.Success;
                    rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.QuestionType);
                }
                else
                {
                    rs.Data           = null;
                    rs.ErrCode        = ErrorCodeEntites.HaveNoData;
                    rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.QuestionType);
                }
            }
            catch (Exception ex)
            {
                rs.Data           = null;
                rs.ErrCode        = ErrorCodeEntites.Fail;
                rs.ErrDescription = ex.ToString();
            }
            return(Json(rs));
        }