示例#1
0
        public void GetRootCategory()
        {
            var rs       = new ResponseClass();
            var category = CategoryController.API_GetRootCategory();

            if (category.Count > 0)
            {
                rs.Code     = APIUtils.GetResponseCode(APIUtils.ResponseCode.SUCCESS);
                rs.Status   = APIUtils.ResponseMessage.Success.ToString();
                rs.Category = category;
            }
            else
            {
                rs.Code    = APIUtils.GetResponseCode(APIUtils.ResponseCode.NotFound);
                rs.Status  = APIUtils.ResponseMessage.Error.ToString();
                rs.Message = APIUtils.OBJ_DNTEXIST;
            }
            Context.Response.ContentType = "application/json";
            Context.Response.Write(JsonConvert.SerializeObject(rs, Formatting.Indented));
            Context.Response.Flush();
            Context.Response.End();
        }