Exemplo n.º 1
0
        public void UpdateRentalGroup(RentalGroups rentalGroup)
        {
            RentalGroups rentalGroupToUpdate = db.RentalGroups.SingleOrDefault(rg => rg.groupID == rentalGroup.groupID);

            rentalGroupToUpdate.comment = rentalGroup.comment;
            rentalGroupToUpdate.deposit = rentalGroup.deposit;
            rentalGroupToUpdate.isOpen  = rentalGroup.isOpen;
            db.SaveChanges();
        }
Exemplo n.º 2
0
 public long AddRentalGroup(RentalGroups rentalGroup)
 {
     db.RentalGroups.Add(rentalGroup);
     foreach (var rental in rentalGroup.Rentals)
     {
         db.Entry(rental.Tools).State     = EntityState.Modified;
         db.Entry(rental.Customers).State = EntityState.Modified;
         if (rental.Customers1 != null)
         {
             db.Entry(rental.Customers1).State = EntityState.Modified;
         }
     }
     db.SaveChanges();
     return(rentalGroup.groupID);
 }
Exemplo n.º 3
0
 public long AddRentalGroup(RentalGroups rentalGroup)
 {
     db.RentalGroups.Add(rentalGroup);
     foreach (var rental in rentalGroup.Rentals)
     {
         db.Entry(rental.Tools).State = EntityState.Modified;
         db.Entry(rental.Customers).State = EntityState.Modified;
         if (rental.Customers1 != null)
         {
             db.Entry(rental.Customers1).State = EntityState.Modified;
         }
     }
     db.SaveChanges();
     return rentalGroup.groupID;
 }
Exemplo n.º 4
0
 public void UpdateRentalGroup(RentalGroups rentalGroup)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 public void UpdateRentalGroup(RentalGroups rentalGroup)
 {
     RentalGroups rentalGroupToUpdate = db.RentalGroups.SingleOrDefault(rg => rg.groupID == rentalGroup.groupID);
     rentalGroupToUpdate.comment = rentalGroup.comment;
     rentalGroupToUpdate.deposit = rentalGroup.deposit;
     rentalGroupToUpdate.isOpen = rentalGroup.isOpen;
     db.SaveChanges();
 }
Exemplo n.º 6
0
 public long AddRentalGroup(RentalGroups rentalGroup)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public long AddRentalGroup(RentalGroups rentalGroup)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public void UpdateRentalGroup(RentalGroups rentalGroup)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
        public static RentalGroups convertRentalGroup(RentalGroup_Representation rentalGroup)
        {
            RentalGroups convertedRentalGroup = new RentalGroups()
            {
                groupID = rentalGroup.id,
                comment = rentalGroup.comment,
                deposit = rentalGroup.deposit,
                isOpen = rentalGroup.isOpen
            };

            Customers customer = convertCustomer(rentalGroup.rentals.FirstOrDefault().customer);
            Customers contact = null;
            if (rentalGroup.rentals.FirstOrDefault().contact != null)
            {
                contact = convertCustomer(rentalGroup.rentals.FirstOrDefault().contact);
            }
            foreach (var rental in rentalGroup.rentals)
            {
                var convertedRental = convertRental(rental);
                convertedRental.Customers = customer;
                if (contact != null)
                {
                    convertedRental.Customers1 = contact;
                }
                convertedRentalGroup.Rentals.Add(convertedRental);
            }

            return convertedRentalGroup;
        }
Exemplo n.º 10
0
        public static RentalGroup_Representation convertRentalGroup(RentalGroups rentalGroup)
        {
            RentalGroup_Representation convertedRentalGroup = new RentalGroup_Representation()
            {
                comment = rentalGroup.comment,
                deposit = rentalGroup.deposit ?? 0,
                id = rentalGroup.groupID,
                isOpen = rentalGroup.isOpen
            };

            foreach (Rentals rental in rentalGroup.Rentals)
            {
                RentalRepresentation rentalToAdd = convertRental(rental);
                rentalToAdd.group = convertedRentalGroup;
                convertedRentalGroup.rentals.Add(rentalToAdd);
            }

            return convertedRentalGroup;
        }