Пример #1
0
        public async Task <int> AddAsync(Driver driver)
        {
            _context.Drivers.Add(driver);

            await _context.SaveChangesAsync();

            return(driver.DriverId);
        }
Пример #2
0
        public async Task <int> AddAsync(Vehicle vehicle)
        {
            _context.Vehicles.Add(vehicle);

            await _context.SaveChangesAsync();

            return(vehicle.VehicleId);
        }
        public async Task <int> AddAsync(Carrier carrier)
        {
            carrier.Picture = Convert.FromBase64String(FakeImages.Carriers[DEFAULT_PICTURE]);
            _context.Carriers.Add(carrier);
            await _context.SaveChangesAsync();

            return(carrier.CarrierId);
        }
Пример #4
0
        public async Task UpdateAsync(Ride ride)
        {
            _context.Rides.Attach(ride);
            _context.Entry(ride).State = EntityState.Modified;

            await _context.SaveChangesAsync();
        }
        public async Task UpdateAsync(Ride ride)
        {
            _context.Rides.Update(ride);

            await _context.SaveChangesAsync();
        }