using Flurl.Http;
|
using System.Collections.Generic;
|
using System.Threading.Tasks;
|
|
namespace TProduct.HttpClient
|
{
|
/// <summary>
|
/// Corpration
|
/// </summary>
|
public partial class LoginUser
|
{
|
/// <summary>
|
/// 插入一条
|
/// </summary>
|
public async Task<bool> InsertAsync(Entity.LoginUser input)
|
{
|
if (input == null)
|
return false;
|
var url = TProduct.HttpClientBase.Build("LoginUser", "Insert@V1.0");
|
var ret = await url.PostJsonAsync(input).ReceiveJson<ApiResult<bool>>();
|
return ret.Data;
|
}
|
|
public void Insert(Entity.LoginUser input)
|
{
|
if (input == null)
|
return;
|
var url = TProduct.HttpClientBase.Build("Auth/LoginUser", "Insert@V1.0");
|
//IFlurlRequest request = url.WithHeader("pump", "1");
|
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
dict.Add("pump", "pump1");
|
dict.Add("Port-Type", "type1");
|
dict.Add("Port-Catalog", "catalog1");
|
IFlurlRequest request = url.WithHeaders(dict, false);
|
|
request.PostJsonAsync(input);
|
|
}
|
|
public async Task<bool> Insert(Entity.LoginUser input, string url)
|
{
|
if (input == null)
|
return false;
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
dict.Add("pump", "pump1");
|
dict.Add("Port-Type", "type1");
|
dict.Add("Port-Catalog", "catalog1");
|
var a = url.WithHeaders(dict, false);
|
var result = await a.PostJsonAsync(input).ReceiveJson<ApiResult<bool>>();
|
return result.Data;
|
}
|
|
|
public void Update(Entity.LoginUser input)
|
{
|
if (input == null)
|
return;
|
var url = TProduct.HttpClientBase.Build("LoginUser", "Update@V1.0");
|
url.WithHeader("Port-Name", "pump1");
|
url.PutJsonAsync(input);//.ReceiveJson<ApiResult<bool>>();
|
}
|
|
|
}
|
}
|