Retail_manager/RMWPFInterfaceLibrary/Api/SaleEndPoint.cs
s459315 f0bea75284 Add Saving Cart to the DB
All the changes necessary to save shopping cart to DB
2022-07-25 17:02:36 +02:00

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);
}
}
}
}
}