public async Task<int> UpDateVendors (Vendors dato) { try { using (var Client = new ApiClient ()) { var entity = JsonConvert.SerializeObject (dato); var Result = await Client.PostAsync ("Vendors/UpDateVendors", new StringContent (entity, UnicodeEncoding.UTF8, "application/json")); var ResultJson = Result.Content.ReadAsStringAsync ().Result; return JsonConvert.DeserializeObject<int> (ResultJson); } } catch (Exception) { throw; } }
public async Task<ResultLogin<Vendors>> LoginVendors (string email, string pwd) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("Vendors/LoginVendors?email=" + email + "&pwd=" + pwd); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<ResultLogin<Vendors>> (ResultJson); return dato; } } catch (Exception) { return null;//LoginVendors( email, pwd); } }
public async void SetConsultProduct (string id, string idp) { try { using (var Client = new ApiClient ()) { await Client.GetAsync ("Clients/SetConsultProduct?id=" + id + "&idp=" + idp); } } catch (Exception) { return; } }
public async void SetLikeProductById (string id) { try { using (var Client = new ApiClient ()) { await Client.GetAsync ("App/SetLikeProductById?id=" + id); } } catch (Exception) { return; } }
public async Task<List<Products>> GetProductByIdCategorys (string id) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("App/GetProductByIdCategorys?id=" + id); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<List<Products>> (ResultJson); return dato; } } catch (Exception) { return null; } }
public async Task <Vendors>GetUser (string email) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("User/GetUser?email=" + email); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<Vendors> (ResultJson); return dato; } } catch (Exception) { return null;//await GetUser (email); } }