public static bool AddReserveDoctor(ReserveDoctorAddModel info) { string url = "/api/UserReserveRecord/Add"; string input = JsonConvert.SerializeObject(info); bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.PostToken(url, input), out string msg); if (!res) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } else { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert("预约成功!")); } return(res); }
public static bool AddNewsComment(NewsCommentAddModel comment) { string url = "/api/NewsComment/Add"; string input = JsonConvert.SerializeObject(comment); bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.PostToken(url, input), out string msg); if (!res) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } else { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert("评论成功!")); } return(res); }
public static bool AddCollectNews(CollectNewsAddModel info, bool isCollect) { string url = "/api/UserCollectNews/Add"; string input = JsonConvert.SerializeObject(info); bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.PostToken(url, input), out string msg); if (!res) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } else { string hint = isCollect ? "取消收藏成功!" : "收藏成功!"; Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(hint)); } return(res); }
public static bool StartDoctor(FollowDoctorModel info) { string url = "/api/UserFollowDoctor/Add"; string input = JsonConvert.SerializeObject(info); bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.PostToken(url, input), out string msg); if (!res) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } else { string hint = info.IsFollow ? "取消关注医生成功!" : "关注医生成功!"; Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(hint)); } return(res); }
public static async Task <DoctorViewModel> GetDoctorDetail(Guid doctorId) { string url = RestClientUtil.GetSpliceUrl("/api/DoctorInfo/Get", new Dictionary <string, string> { { "id", doctorId.ToString() } }); string msg = String.Empty; string content = await RestClientUtil.GetUnTokenAsync(url); var data = await Task.Run(() => ParseResponseJsonContent.ParseObj <DoctorViewModel>(content, out msg)); if (data == null) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } return(data); }
public static bool CancelReserveDoctor(int id) { string url = RestClientUtil.GetSpliceUrl("/api/UserReserveRecord/Delete", new Dictionary <string, string> { { "id", id.ToString() } }); bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.DeleteToken(url), out string msg); if (!res) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } else { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert("取消预约成功!")); } return(res); }
public static async Task <ObservableCollection <string> > GetTimeLineYear(string idNo) { string url = RestClientUtil.GetSpliceUrl("/api/UserRecipeRecord/GetTimeLineByIdNo", new Dictionary <string, string> { { "IdNo", idNo } }); string content = await RestClientUtil.GetTokenAsync(url); return(await Task.Run(() => { string msg = String.Empty; if (!string.IsNullOrWhiteSpace(content)) { try { var obj = JsonConvert.DeserializeObject <ResponseBaseModel>(content); if (obj.code == 0) { if (!string.IsNullOrEmpty(obj.data.ToString())) { var temp = JsonConvert.DeserializeObject <ObservableCollection <string> >(obj.data.ToString()); msg = obj.msg; return temp; } } msg = obj.msg; return null; } catch (Exception ex) { //logger.ErrorLog($"JSON->List数据反序列化出错!", ex); throw new Exception($"JSON->List数据反序列化出错!", ex); } } msg = "响应返回数据为空!"; return null; })); }
public static IEnumerable <DicFrequencyModel> GetFrequencys() { return(ParseResponseJsonContent.ParseList <DicFrequencyModel>(RestClientUtil.GetUnToken("/api/DicFrequency/Gets"), out string msg)); }
public static IEnumerable <DicRecipeTypeModel> GetRecipeTypes() { return(ParseResponseJsonContent.ParseList <DicRecipeTypeModel>(RestClientUtil.GetUnToken("/api/DicRecipeType/Gets"), out string msg)); }
public static UserInfoModel Login(LoginModel info) { string url = "/api/UserInfo/Login"; string input = JsonConvert.SerializeObject(info); RegisteredReturnModel returnModel = ParseResponseJsonContent.ParseObj <RegisteredReturnModel>(RestClientUtil.PostUnToken(url, input), out string msg); if (returnModel == null) { Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg)); } RestClientUtil.Token = returnModel?.Access_token; return(returnModel?.UserInfo); }
public static async Task <IEnumerable <HospitalViewModel> > GetHospitals() { string content = await RestClientUtil.GetUnTokenAsync("/api/HospitalInfo/Gets"); return(await Task.Run(() => ParseResponseJsonContent.ParseList <HospitalViewModel>(content, out string msg))); }