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); }
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); }
public async Task <ShopingCartItem> Delete(ShopingCartItemDto entity) { var item = _context.ShopingCart.Remove(await _context.ShopingCart.FindAsync(entity.Id)).Entity; return(item); }