Esempio n. 1
0
 public async Task AddTransaction(Transaction transaction)
 {
     using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
     {
         showRoomDbContext.Transactions.Add(transaction);
         await showRoomDbContext.SaveChangesAsync();
     }
 }
Esempio n. 2
0
 public async Task AddCustomer(Customer customer)
 {
     using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
     {
         showRoomDbContext.Customers.Add(customer);
         await showRoomDbContext.SaveChangesAsync();
     }
 }
Esempio n. 3
0
 public async Task AddBrand(Brand brand)
 {
     using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
     {
         showRoomDbContext.Brands.Add(brand);
         await showRoomDbContext.SaveChangesAsync();
     }
 }
Esempio n. 4
0
 public async Task  AddBike(Bike bike)
 {
     using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
     {
         showRoomDbContext.Bikes.Add(bike);
         await showRoomDbContext.SaveChangesAsync();
     }
 }
Esempio n. 5
0
        public async Task <List <Bike> > GetBike()
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                List <Bike> bikes = await showRoomDbContext.Bikes.ToListAsync();

                return(bikes);
            }
        }
Esempio n. 6
0
 public async Task DeleteBike(int bikeId)
 {
     using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
     {
         var d = showRoomDbContext.Bikes.Single(x => x.BikeId == bikeId);
         showRoomDbContext.Bikes.Remove(d);
         await showRoomDbContext.SaveChangesAsync();
     }
 }
Esempio n. 7
0
        public async Task <List <Bike> > CustomerChoice(string brandName)
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                List <Bike> bikes = await showRoomDbContext.Bikes.Where(x => x.BrandName == brandName).ToListAsync();

                return(bikes);
            }
        }
Esempio n. 8
0
        public async Task <List <Brand> > CheckBrand()
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                List <Brand> brands = await showRoomDbContext.Brands.ToListAsync();

                return(brands);
            }
        }
Esempio n. 9
0
        public async Task <Customer> GetCustomer(string name)
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                var nofcustomer = showRoomDbContext.Customers.First(x => x.Email.Equals(name));
                await showRoomDbContext.SaveChangesAsync();

                return(nofcustomer);
            }
        }
Esempio n. 10
0
        public async Task <Bike> GetBikeDetails(int bikeId)
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                Bike bike = showRoomDbContext.Bikes.First(x => x.BikeId == bikeId);
                await showRoomDbContext.SaveChangesAsync();

                return(bike);
            }
        }
Esempio n. 11
0
        public async Task  UpdateBike(Bike bike)
        {
            using (ShowRoomDbContext showRoomDbContext = new ShowRoomDbContext())
            {
                Bike bikeUpdate = showRoomDbContext.Bikes.Find(bike.BikeId);

                bikeUpdate.BikeName   = bike.BikeName;
                bikeUpdate.BikeCC     = bike.BikeCC;
                bikeUpdate.DiscBrakes = bike.DiscBrakes;
                bikeUpdate.BikePrice  = bike.BikePrice;
                bikeUpdate.Milage     = bike.Milage;
                await showRoomDbContext.SaveChangesAsync();
            }
        }