f0bea75284
All the changes necessary to save shopping cart to DB
35 lines
873 B
C#
35 lines
873 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 SaleEndPoint : ISaleEndPoint
|
|
{
|
|
private IAPIHelper _apiHelper;
|
|
public SaleEndPoint(IAPIHelper apiHelper)
|
|
{
|
|
_apiHelper = apiHelper;
|
|
}
|
|
|
|
public async Task PostSale(SaleModel sale)
|
|
{
|
|
using (HttpResponseMessage response = await _apiHelper.ApiClient.PostAsJsonAsync("api/Sale", sale))
|
|
{
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
// Log call
|
|
}
|
|
else
|
|
{
|
|
throw new Exception(response.ReasonPhrase);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|