/// <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); }
/// <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); } }
/// <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); } }