Пример #1
0
        private static void RemoveJoinBetweenSamuraiAndBattleSimple()
        {
            var join = new SamuraiBattle {
                BattleId = 1, SamuraiId = 2
            };

            _context.Remove(join);
            _context.SaveChanges();
        }
        public IActionResult DeleteCar([FromRoute] int id)
        {
            var cars = _context.Cars.SingleOrDefault(x => x.Id == id);

            if (cars == null)
            {
                return(BadRequest(new { invalid = "Такої машини немає!" }));
            }

            _context.Remove(cars);
            _context.SaveChanges();

            return(Ok(cars.Id));
        }