コード例 #1
0
        public async Task <Tobacco> Put(Tobacco tobacco)
        {
            if (tobacco == null)
            {
                return(null);
            }
            if (!db.Tobaccos.Any(x => x.Id == tobacco.Id))
            {
                return(null);
            }

            db.Update(tobacco);
            await db.SaveChangesAsync();

            return(tobacco);
        }
コード例 #2
0
        public async Task <ActionResult <Order> > Put(int id, Order order)
        {
            if (order == null)
            {
                return(BadRequest());
            }
            if (!db.Orders.Any(x => x.Id == id))
            {
                return(NotFound());
            }

            db.Update(order);
            await db.SaveChangesAsync();

            return(Ok(order));
        }