public static async Task <string> PostAsync(string uri, ClientCommand body) { var client = new HttpClient(); var encoding = CodePagesEncodingProvider.Instance.GetEncoding(1251); var httpContent = new StringContent(body.ToForm(), encoding, "application/x-www-form-urlencoded"); var resp = await client.PostAsync(uri, httpContent); return(await ParseResult(resp.Content)); }
public static async Task <List <Ticket> > GetTicketsByDoc(string uri, Doctor doc) { var body = new ClientCommand() .AddMenuCode(Commands.GetTickets) .AddDoctorCode(doc.Key) .AddAnyTimeCommand(); var result = await WebClient.PostAsync(uri, body); return(Parser.GetTicketsFromHtml(result).ToList()); }
public static async Task <List <Specialty> > GetSpecialitiesAsync(string uri) { var body = new ClientCommand() .AddMenuCode(Commands.GetSpecs); var result = await WebClient.PostAsync(uri, body); return(Parser .GetDataFromInput(result) .Select(valueTuple => new Specialty { Name = valueTuple.data, Key = valueTuple.key }) .ToList()); }
public static async Task <List <Doctor> > GetDoctorsBySpec(string uri, Specialty spec) { var body = new ClientCommand() .AddMenuCode(Commands.GetDoctorsBySpec) .AddSpecCode(spec.Key); var result = await WebClient.PostAsync(uri, body); return(Parser .GetDataFromInput(result) .Select(valueTuple => new Doctor { Name = valueTuple.data, Key = valueTuple.key }) .ToList()); }