Skip to content

Instantly share code, notes, and snippets.

View huseyinafsin's full-sized avatar
🛴
On site

Hüseyin AFŞİN huseyinafsin

🛴
On site
View GitHub Profile
[Route("api/[controller]")]
[ApiController]
public class BasketController : ControllerBase
{
private readonly IBasketRepository _basketRepository;
public BasketController(IBasketRepository basketRepository)
{
_basketRepository = basketRepository;
}
public interface IBasketRepository
{
Task<Basket> GetCustomerBasketAsync(string customerId);
Task<Basket> UpdateBasketAsync(Basket basket);
Task<bool> DeleteBasketAsync(string id);
Task<bool> RemoveItemFromBasket(string customerId, string itemId);
}
@huseyinafsin
huseyinafsin / Basket.cs
Last active June 4, 2023 06:24
Gist for Redis implementation using dotnet core on Medium
public class Basket
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string CustomerId { get; set; }
public double TotalAmount { get; set; }
public List<BasketItem> Items { get; set; }
}