예제 #1
0
        /// <summary>
        /// Creates a new object from the provided CommonResponseObject
        /// </summary>
        /// <param name="toCreate"></param>
        /// <returns></returns>
        public IRequestResponse Create(T toCreate)
        {
            string res      = ReqManager.Post(EndPoint, toCreate);
            var    response = JsonConvert.DeserializeObject <RequestResponse>(res);

            return(response);
        }
예제 #2
0
        /// <summary>
        /// Creates a new object from the provided CommonResponseObject
        /// </summary>
        /// <param name="toCreate"></param>
        /// <returns></returns>
        public IRequestResponse Create(T toCreate)
        {
            System.Console.WriteLine("Attempting to create type: " + typeof(T).ToString());
            System.Console.WriteLine("Instance name: " + toCreate.Name.ToString());

            // Update functionality could be put in here
            SearchFilter filter   = new SearchFilter(toCreate.Name);
            T            existing = this.FindOne(filter);

            if (existing != null)
            {
                System.Console.WriteLine("Already exists in DB", typeof(T).ToString());
                return(null);
            }
            else
            {
                // TODO: Properly parse and log request response.
                string res = ReqManager.Post(EndPoint, toCreate);
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a new object from the provided CommonResponseObject
        /// </summary>
        /// <param name="toCreate"></param>
        /// <returns></returns>
        public IRequestResponse Create(T toCreate)
        {
            System.Console.WriteLine("Attempting to create type: " + typeof(T).ToString());
            System.Console.WriteLine("Instance name: " + toCreate.Name.ToString());

            // Update functionality could be put in here
            SearchFilter filter   = new SearchFilter(toCreate.Name);
            T            existing = this.FindOne(filter);

            if (existing != null)
            {
                System.Console.WriteLine("Already exists in DB", typeof(T).ToString());
                return(null);
            }
            else
            {
                // TODO: Make json properly here
                string res      = ReqManager.Post(EndPoint, toCreate);
                var    response = JsonConvert.DeserializeObject <RequestResponse>(res);
                return(response);
            }
        }