public T Add(T entity) { RestSharpCall.Init(apiContext.CurrentContext.Uri + urlValues, RestSharpMethod.POST); var apiResponse = RestSharpCall.MakeAsync <object>(parameters, headers, null, null, null, entity); return(entity); }
public dynamic Update(T entity) { RestSharpCall.Init(apiContext.CurrentContext.Uri + urlValues, RestSharpMethod.PUT); var response = RestSharpCall.MakeAsync <object>(parameters, headers, null, null, null, entity); return(response); }
public dynamic Delete(dynamic id) { RestSharpCall.Init(apiContext.CurrentContext.Uri + "/" + id, RestSharpMethod.DELETE); var response = RestSharpCall.MakeAsync <object>(null, headers); return(response); }
public T Get() { RestSharpCall.Init(apiContext.CurrentContext.Uri + urlValues, RestSharpMethod.GET); var apiResponse = RestSharpCall.MakeAsync <object>(parameters, headers, null, null, null, null); if (apiResponse != null) { T response = JsonConvert.DeserializeObject <T>(apiResponse.ToString()); return(response); } return(null); }
public IQueryable <T> GetAll() { IList <T> response = new List <T>(); RestSharpCall.Init(apiContext.CurrentContext.Uri + urlValues, RestSharpMethod.GET); var apiResponse = RestSharpCall.MakeAsync <List <object> >(parameters, headers); if (apiResponse != null) { apiResponse.ForEach(x => { response.Add(JsonConvert.DeserializeObject <T>(x.ToString())); }); } return(response.AsQueryable()); }