2018-07-31 11:30:00 +02:00
|
|
|
|
namespace WebMVC.Infrastructure
|
2017-05-04 13:01:14 +02:00
|
|
|
|
{
|
|
|
|
|
public static class API
|
|
|
|
|
{
|
|
|
|
|
|
2018-01-31 15:35:40 +00:00
|
|
|
|
public static class Purchase
|
|
|
|
|
{
|
|
|
|
|
public static string AddItemToBasket(string baseUri) => $"{baseUri}/basket/items";
|
2018-01-31 16:29:06 +00:00
|
|
|
|
public static string UpdateBasketItem(string baseUri) => $"{baseUri}/basket/items";
|
2018-02-01 14:04:20 +00:00
|
|
|
|
|
|
|
|
|
public static string GetOrderDraft(string baseUri, string basketId) => $"{baseUri}/order/draft/{basketId}";
|
2018-01-31 15:35:40 +00:00
|
|
|
|
}
|
2017-05-11 11:51:13 +02:00
|
|
|
|
|
2018-01-31 15:35:40 +00:00
|
|
|
|
public static class Basket
|
|
|
|
|
{
|
|
|
|
|
public static string GetBasket(string baseUri, string basketId) => $"{baseUri}/{basketId}";
|
|
|
|
|
public static string UpdateBasket(string baseUri) => baseUri;
|
|
|
|
|
public static string CheckoutBasket(string baseUri) => $"{baseUri}/checkout";
|
|
|
|
|
public static string CleanBasket(string baseUri, string basketId) => $"{baseUri}/{basketId}";
|
2017-05-04 13:01:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Order
|
|
|
|
|
{
|
|
|
|
|
public static string GetOrder(string baseUri, string orderId)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}/{orderId}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetAllMyOrders(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return baseUri;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string AddNewOrder(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}/new";
|
|
|
|
|
}
|
2017-05-11 11:51:13 +02:00
|
|
|
|
|
|
|
|
|
public static string CancelOrder(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}/cancel";
|
|
|
|
|
}
|
2017-05-14 14:48:37 +02:00
|
|
|
|
|
|
|
|
|
public static string ShipOrder(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}/ship";
|
|
|
|
|
}
|
2017-05-04 13:01:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Catalog
|
|
|
|
|
{
|
|
|
|
|
public static string GetAllCatalogItems(string baseUri, int page, int take, int? brand, int? type)
|
|
|
|
|
{
|
|
|
|
|
var filterQs = "";
|
|
|
|
|
|
2018-07-31 11:30:00 +02:00
|
|
|
|
if (type.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var brandQs = (brand.HasValue) ? brand.Value.ToString() : string.Empty;
|
|
|
|
|
filterQs = $"/type/{type.Value}/brand/{brandQs}";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (brand.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var brandQs = (brand.HasValue) ? brand.Value.ToString() : string.Empty;
|
|
|
|
|
filterQs = $"/type/all/brand/{brandQs}";
|
|
|
|
|
}
|
|
|
|
|
else
|
2017-05-04 13:01:14 +02:00
|
|
|
|
{
|
2018-07-31 11:30:00 +02:00
|
|
|
|
filterQs = string.Empty;
|
2017-05-04 13:01:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $"{baseUri}items{filterQs}?pageIndex={page}&pageSize={take}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetAllBrands(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}catalogBrands";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetAllTypes(string baseUri)
|
|
|
|
|
{
|
|
|
|
|
return $"{baseUri}catalogTypes";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-16 16:50:15 +02:00
|
|
|
|
}
|