// Select House
 public House Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.houses.Find(id));
     }
 }
 // Select Boat
 public Boat Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.boats.Find(id));
     }
 }
Exemple #3
0
 // Read InvoiceLine
 public List <InvoiceLine> Read()
 {
     using (RentalContext db = new RentalContext())
     {
         return(null);
     }
 }
Exemple #4
0
 // Select InvoiceLine
 public InvoiceLine Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.invoiceLines.Find(id));
     }
 }
 // Read Rent
 public List <Rent> Read()
 {
     using (RentalContext db = new RentalContext())
     {
         return(null);
     }
 }
Exemple #6
0
 // Select Car
 public Car Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.cars.Find(id));
     }
 }
Exemple #7
0
 // Create Client
 public void Create(Client client)
 {
     using (RentalContext db = new RentalContext())
     {
         db.clients.Add(client);
     }
 }
 // Select Employee
 public Employee Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.employees.Find(id));
     }
 }
Exemple #9
0
 // Select Client
 public Client Select(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         return(db.clients.Find(id));
     }
 }
 // Create Boat
 public void Create(Boat boat)
 {
     using (RentalContext db = new RentalContext())
     {
         db.boats.Add(boat);
         db.SaveChanges();
     }
 }
 // Delete Boat
 public void Delete(int id)
 {
     using (RentalContext db = new RentalContext())
     {
         Boat findBoat = db.boats.Find(id);
         findBoat.active = false;
         db.SaveChanges();
     }
 }
 // Update Boat
 public void Update(Boat boat)
 {
     using (RentalContext db = new RentalContext())
     {
         Boat findBoat = db.boats.Find(boat.id);
         findBoat.costPerDay     = boat.costPerDay;
         findBoat.description    = boat.description;
         findBoat.numPassengers  = boat.numPassengers;
         findBoat.type           = boat.type;
         findBoat.brand          = boat.brand;
         findBoat.model          = boat.model;
         findBoat.competitorCode = boat.competitorCode;
         db.SaveChanges();
     }
 }
        // Read Boat
        public List <Boat> Read()
        {
            using (RentalContext db = new RentalContext())
            {
                List <Boat> boats = new List <Boat>();

                foreach (Boat item in db.boats)
                {
                    if (item.active == true)
                    {
                        boats.Add(item);
                    }
                }
                return(boats);
            }
        }
Exemple #14
0
 // Delete InvoiceLine
 public void Delete(InvoiceLine invoiceLine)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
 // Delete House
 public void Delete(House house)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
Exemple #16
0
 // Delete Car
 public void Delete(Car car)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
 // Delete Employee
 public void Delete(Employee employee)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
Exemple #18
0
 // Update Client
 public void Update(Client client)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
 // Delete Rent
 public void Delete(Rent rent)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }
 // Update Invoice
 public void Update(Invoice invoice)
 {
     using (RentalContext db = new RentalContext())
     {
     }
 }