Пример #1
0
        public async Task <IActionResult> DeleteVehicle(int id)
        {
            var vehicle = await context.Vehicles.FindAsync(id);

            context.Remove(vehicle);
            await context.SaveChangesAsync();

            return(Ok(vehicle));
        }
Пример #2
0
        public async Task <IActionResult> DeleteVehicle(int id)
        {
            var vehicle = await context.Vehicles.FindAsync(id);

            if (vehicle == null)
            {
                return(NotFound());
            }
            context.Remove(vehicle);
            await context.SaveChangesAsync();

            return(Ok(id));
        }
Пример #3
0
 public void Remove(Vehicle vehicle) => context.Remove(vehicle);
Пример #4
0
 public void Delete <T>(T entity) where T : class
 {
     _ctx.Remove(entity);
 }
Пример #5
0
 public void Delete(Vehicle vehicle)
 {
     context.Remove(vehicle);
 }
Пример #6
0
 public void Delete <T>(T entity) where T : class
 {
     context.Remove(entity);
 }
Пример #7
0
 public void Remove(Vehicle vehicle)
 {
     dbContext.Remove <Vehicle>(vehicle);
 }