public async Task<ResultMsg<Users>> SetUser( Users user) { try { using (var Client = new ApiClient ()) { var entity = JsonConvert.SerializeObject (user); var Result = await Client.PostAsync ("User/Register", new StringContent (entity, UnicodeEncoding.UTF8, "application/json")); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<ResultMsg<Users>> (ResultJson); Client.Dispose (); return dato; } } catch (Exception) { return null; } }
public async Task<bool> ValidaEmail(string email) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("User/ValidaEmail?email="+email); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<bool> (ResultJson); return dato; } } catch (Exception) { return true; } }
public async Task<ResultMsg<Users>> Login(string email,string pwd) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("User/Login?email="+email+"&pwd="+pwd); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<ResultMsg<Users>> (ResultJson); return dato; } } catch (Exception) { return null; } }
public async Task<PublicViews> GetPublicViewsByIdUser(string id,string IdCategory,string key) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("Grill/GetPublicViewsByIdUser?id="+id+"&idc="+IdCategory+"&key="+key); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<PublicViews> (ResultJson); return dato; } } catch (Exception) { return null; } }
public async Task<PublicViews> GetPublicViews(string id) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("Grill/GetPublicViews?id="+id); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<PublicViews> (ResultJson); return dato; } } catch (Exception) { return null; } }
public async Task<List<PublicViews>> GetAllPublicViews() { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("User/GetAllPublicViews"); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<List<PublicViews>> (ResultJson); return dato; } } catch (Exception) { return null; } }
public async Task<int> UpdatePoint(string id ,string idp, string key) { try { using (var Client = new ApiClient ()) { var Result = await Client.GetAsync ("User/UpdatePoint?id="+id+"&idp="+idp+"&key="+key); var ResultJson = Result.Content.ReadAsStringAsync ().Result; var dato = JsonConvert.DeserializeObject<int> (ResultJson); return dato; } } catch (Exception) { return 0; } }
public async void UpdateGCM(string email ,string RegisterID) { try { using (var Client = new ApiClient ()) { await Client.GetAsync ("User/UpdateGcm?email="+email+"&gcmid="+RegisterID); } } catch (Exception) { return; } }