示例#1
0
        public void DeleteCupcake(int id)
        {
            var cupcake = _context.Cupcakes.First(c => c.CupcakeId == id);

            _context.Remove(cupcake);
            _context.SaveChanges();
        }
示例#2
0
 public void DeleteCupcake(int id)
 {
     _ = _context.Remove(_context.Cupcakes.SingleOrDefault(c => c.CupcakeID == id));
     _ = _context.SaveChanges();
 }