public async Task <bool> Create(TModel model) { var settings = new HttpSettings($"{this.Url}", null, null, $"{this._caption} adding"); var body = new HttpBody <TModel>(model); return(await this.Http.Create <TModel>(settings, body)); }
public async Task <bool> Update(int id, TModel model) { var pathParams = new HttpPathParameters(); pathParams.Add <int>(id, -1); var settings = new HttpSettings($"{this.Url}", null, pathParams, $"{this._caption} updating"); var body = new HttpBody <TModel>(model); return(await this.Http.Update <TModel>(settings, body)); }
/// <summary> /// POST request where we want string response /// </summary> /// <param name="settings">HTTP settings</param> /// <param name="body">Body of post request</param> /// <typeparam name="T">Type of the body</typeparam> /// <returns>Response string value</returns> public async Task <string> CreateString <T>(HttpSettings settings, HttpBody <T> body) { return(await CreateWithResult <string, T>(settings, body)); }
/// <summary> /// POST request /// </summary> /// <param name="settings">HTTP settings</param> /// <param name="body">Body of post request</param> /// <typeparam name="T">Type of the body</typeparam> /// <returns>The request was success or not</returns> public async Task <bool> Create <T>(HttpSettings settings, HttpBody <T> body) { return((await SendRequest <object>(settings, HttpMethod.Post, body.GetStringContent())).IsSuccess); }
public async Task <T> CreateWithResult <T, TBody>(HttpSettings settings, HttpBody <TBody> body) { return((await SendRequest <T>(settings, HttpMethod.Post, body.GetStringContent(), true)).Content); }
public async Task <bool> Download <T>(HttpSettings settings, T model) { var body = new HttpBody <T>(model); return(Download(await UpdateWithResult <ExportResult, T>(settings, body))); }
public async Task <int> CreateInt <T>(HttpSettings settings, HttpBody <T> body) { return(await CreateWithResult <int, T>(settings, body)); }