Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Zen.API;
- using ZenUWP.Models;
- namespace API.Methods
- {
- public class Pizzas
- {
- private const string endpoint = "pizzas";
- public static async Task<PizzaItem> GetPizzaItem(int id)
- {
- //Тут составляем url для GET-запроса, для примера просто сложил все нужные string
- var response = await APIRequestService.Request<PizzaItem>(endpoint + "/getPizzaItem?" + "id=" + id);
- return response;
- }
- public static async Task<IEnumerable<PizzaItem>> GetPizzaItems()
- {
- //GET-запрос без параметров
- var response = await APIRequestService.Request<IEnumerable<PizzaItem>>(endpoint + "/getPizzaItems?");
- return response;
- }
- public static async Task<PizzaItem>> PostTodoItem(PizzaItem pizza)
- {
- //POST-запрос, добавляем анонимный объект с именноваными параметрами
- var response = await APIRequestService.Request<PizzaItem>(endpoint + "/postTodoItem?", new { pizza = pizza });
- return response;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment