69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
|
namespace WebMVC.Infrastructure
|
|||
|
{
|
|||
|
public static class API
|
|||
|
{
|
|||
|
public static class Basket
|
|||
|
{
|
|||
|
public static string GetBasket(string baseUri, string basketId)
|
|||
|
{
|
|||
|
return $"{baseUri}/{basketId}";
|
|||
|
}
|
|||
|
|
|||
|
public static string UpdateBasket(string baseUri)
|
|||
|
{
|
|||
|
return baseUri;
|
|||
|
}
|
|||
|
|
|||
|
public static string CleanBasket(string baseUri, string basketId)
|
|||
|
{
|
|||
|
return $"{baseUri}/{basketId}";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
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";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static class Catalog
|
|||
|
{
|
|||
|
public static string GetAllCatalogItems(string baseUri, int page, int take, int? brand, int? type)
|
|||
|
{
|
|||
|
var filterQs = "";
|
|||
|
|
|||
|
if (brand.HasValue || type.HasValue)
|
|||
|
{
|
|||
|
var brandQs = (brand.HasValue) ? brand.Value.ToString() : "null";
|
|||
|
var typeQs = (type.HasValue) ? type.Value.ToString() : "null";
|
|||
|
filterQs = $"/type/{typeQs}/brand/{brandQs}";
|
|||
|
}
|
|||
|
|
|||
|
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";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|