コード例 #1
0
        public async Task <bool> UpdateItem(int storeId, int itemId, Item item)
        {
            _context.Entry(item).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemExists(itemId))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #2
0
        public async Task <bool> UptadeOrderItem(int id, OrderItem orderItem)
        {
            _context.Entry(orderItem).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderItemExists(id))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #3
0
        public async Task <bool> UpdateModifier(int modifierId, int itemId, StoreModifier modifier)
        {
            _context.Entry(modifier).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ModifierExists(modifierId))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #4
0
        public async Task <bool> UpdateStore(int id, Store store)
        {
            _context.Entry(store).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StoreExists(id))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }
        }