Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 /// <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));
 }
Exemplo n.º 4
0
 /// <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);
 }
Exemplo n.º 5
0
 public async Task <T> CreateWithResult <T, TBody>(HttpSettings settings, HttpBody <TBody> body)
 {
     return((await SendRequest <T>(settings, HttpMethod.Post, body.GetStringContent(), true)).Content);
 }
Exemplo n.º 6
0
        public async Task <bool> Download <T>(HttpSettings settings, T model)
        {
            var body = new HttpBody <T>(model);

            return(Download(await UpdateWithResult <ExportResult, T>(settings, body)));
        }
Exemplo n.º 7
0
 public async Task <int> CreateInt <T>(HttpSettings settings, HttpBody <T> body)
 {
     return(await CreateWithResult <int, T>(settings, body));
 }