Пример #1
0
        /// <summary>
        /// Comman responce for api
        /// </summary>
        /// <param name="statusCode"></param>
        /// <param name="success"></param>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public ObjectResult CustomResponce(int statusCode, bool success, string message, dynamic data)
        {
            var responce = new ApiResponce()
            {
                Success = success,
                Message = message,
                Data    = data
            };

            return(StatusCode(statusCode: statusCode, value: responce));
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            dynamic obj = JObject.Load(reader);

            var responce = new ApiResponce
            {
                Count = obj.count,
                Self  = obj.links.self,
                Next  = obj.links.next,
                Data  = obj.data.ToObject <FeatureCollection>()
            };

            return(responce);
        }