private void UpdateTotalBasket(Guid basketId)
        {
            var basket = _context.Baskets.Where(b => b.Id == basketId)
                         .FirstOrDefault();

            if (basket != null)
            {
                basket.Total      = GetTotalBasket(basketId);
                basket.UpdateDate = DateTime.Now;

                _context.Baskets.Add(basket);
                _context.Entry(basket).State = EntityState.Modified;
                _context.SaveChanges();
            }
        }
Esempio n. 2
0
 public async Task Update(T entity)
 {
     _appDbContext.Entry(entity).State = EntityState.Modified;
     await _appDbContext.SaveChangesAsync();
 }