Пример #1
0
        public async Task <ActionResult <Car> > PutCar(long id, Car car)
        {
            if (id != car.CarId)
            {
                return(null);
            }
            _context.Entry(car).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(car);
        }
Пример #2
0
        public async Task <ActionResult <TypeCar> > PutTypeCar(long id, TypeCar typeCar)
        {
            if (id != typeCar.TypeCarId)
            {
                return(null);
            }
            _context.Entry(typeCar).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(typeCar);
        }
Пример #3
0
        public async Task <ActionResult <FamilyCar> > PutFamilyCar(long id, FamilyCar familyCar)
        {
            if (id != familyCar.FamilyCarId)
            {
                return(null);
            }
            _context.Entry(familyCar).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(familyCar);
        }
Пример #4
0
        public async Task <ActionResult <User> > PutUser(long id, User user)
        {
            if (id != user.UserId)
            {
                return(null);
            }
            _context.Entry(user).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(user);
        }
Пример #5
0
        public async Task <ActionResult <Car> > UpdateUserCar(long userId, long carId, Car car)
        {
            /* var car = await _context.Car.Where(u => u.CarId == carId && u.UserId == userId)
             *   .FirstOrDefaultAsync();*/
            if (userId != car.UserId && carId != car.CarId)
            {
                return(null);
            }

            _context.Entry(car).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(car);
        }