57d2ab60a7
Created and binded a View, created logic behind Cart Product Model
37 lines
971 B
C#
37 lines
971 B
C#
using RMWPFInterfaceLibrary.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RMWPFInterfaceLibrary.Api
|
|
{
|
|
public class ProductEndPoint : IProductEndPoint
|
|
{
|
|
private IAPIHelper _apiHelper;
|
|
public ProductEndPoint(IAPIHelper apiHelper)
|
|
{
|
|
_apiHelper = apiHelper;
|
|
}
|
|
|
|
public async Task<List<ProductModel>> GetAll()
|
|
{
|
|
using (HttpResponseMessage response = await _apiHelper.ApiClient.GetAsync("api/Product"))
|
|
{
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
var result = await response.Content.ReadAsAsync<List<ProductModel>>();
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
throw new Exception(response.ReasonPhrase);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|