public async Task <ActionResult <FamilyCar> > PostFamilyCar(FamilyCar familyCar) { _context.FamilyCar.Add(familyCar); await _context.SaveChangesAsync(); return(familyCar); }
public async Task <ActionResult <TypeCar> > PostTypeCar(TypeCar typeCar) { _context.TypeCar.Add(typeCar); await _context.SaveChangesAsync(); return(typeCar); }
public async Task <ActionResult <Tracks> > SaveTracking(Tracks tracks) { await _context.Tracks.AddAsync(tracks); await _context.SaveChangesAsync(); return(tracks); }
public async Task <ActionResult <Car> > DeleteCar(long id) { var car = await _context.Car.FindAsync(id); _context.Car.Remove(car); await _context.SaveChangesAsync(); return(car); }
public async Task <ActionResult <Car> > DeleteUserCar(long userid, long carid) { var car = await _context.Car.Where(u => u.CarId == carid && u.UserId == userid).FirstOrDefaultAsync(); _context.Car.Remove(car); await _context.SaveChangesAsync(); return(car); }
public async Task <ActionResult <User> > DeleteUser(long id) { var user = await _context.User.FindAsync(id); _context.User.Remove(user); await _context.SaveChangesAsync(); return(user); }
public async Task <ActionResult <User> > SignUp(User user) { _context.User.Add(user); await _context.SaveChangesAsync(); return(user); }
public async Task <ActionResult <Location> > DeleteUserLocation(long userid, long locId) { var location = await _context.Location.Include(u => u.LocationId == locId).FirstOrDefaultAsync(car => car.UserId == userid); if (location == null) { return(null); } _context.Location.Remove(location); await _context.SaveChangesAsync(); return(location); }