public async Task <ActionResult <CustomerBasket> > UpdateBasket(CustomerBasketDTO basket) { var customerBasket = _mapper.Map <CustomerBasketDTO, CustomerBasket>(basket); var updatedBasket = await _basketRepository.UpdateBasketAsync(customerBasket); return(Ok(updatedBasket)); }
public async Task <CustomerBasketDTO> UpdateBasketAsync(CustomerBasketDTO customerBasket) { //if there is not any action about the card in a day, it is fallen out of cache var option = new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromDays(1)); await _distributedCache.SetStringAsync(customerBasket.CustomerId, JsonConvert.SerializeObject(customerBasket), option); return(await GetBasketAsync(customerBasket.CustomerId)); }