Exemplo n.º 1
0
        public static async Task <NewsModel> GetNewsDetail(int id)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/News/Get", new Dictionary <string, string>
            {
                { "Id", id.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <NewsModel>(content, out string msg)));
        }
Exemplo n.º 2
0
        public static async Task <RecipeRecordModel> GetRecipeRecord(int id)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserRecipeRecord/GetById", new Dictionary <string, string>
            {
                { "Id", id.ToString() }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <RecipeRecordModel>(content, out string msg)));
        }
Exemplo n.º 3
0
        public static async Task <NewsPageModel> GetNews(PageInquireModel page)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/News/GetsPage", new Dictionary <string, string>
            {
                { "Index", page.Index.ToString() }, { "Size", page.Size.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(function : () => ParseResponseJsonContent.ParseObj <NewsPageModel>(content, out string msg)));
        }
Exemplo n.º 4
0
        public static async Task <ChatMainModel> GetChatInfo(Guid userId, Guid anotherId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/ChatMain/Get", new Dictionary <string, string>
            {
                { "userId", userId.ToString() }, { "anotherId", anotherId.ToString() },
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <ChatMainModel>(content, out string msg)));
        }
Exemplo n.º 5
0
        public static async Task <PageDataModel <DoctorViewModel> > GetDoctorsPage(string hosCode, int index, int size)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/DoctorInfo/GetsPage", new Dictionary <string, string>
            {
                { "hosCode", hosCode }, { "index", index.ToString() }, { "size", size.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <PageDataModel <DoctorViewModel> >(content, out string msg)));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }