예제 #1
0
        public async Task <ShopingCartItem> EditAsync(int id, ShopingCartItemDto entity)
        {
            _context.Entry(await _context.ShopingCart.FirstOrDefaultAsync(x => x.Id == id) !).CurrentValues
            .SetValues(entity);
            var comment = await _context.ShopingCart.FindAsync(id);

            return(comment);
        }
예제 #2
0
        public async Task <ShopingCartItem> CreateAsync(ShopingCartItemDto entity)
        {
            var cartItem = _mapper.Map <ShopingCartItem>(entity);

            if (cartItem == null)
            {
                return(null);
            }
            var entityEntry = await _context.ShopingCart.AddAsync(cartItem);

            return(entityEntry.Entity);
        }
예제 #3
0
        public async Task <ShopingCartItem> Delete(ShopingCartItemDto entity)
        {
            var item = _context.ShopingCart.Remove(await _context.ShopingCart.FindAsync(entity.Id)).Entity;

            return(item);
        }