//Update the package details
 public void UpdatePackage(Package package)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Entry(package).State = EntityState.Modified;//Updating package in database
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void AddOrderDetails(Order orderDetails)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.OrderDetails.Add(orderDetails);
         context.SaveChanges();
     }
 }
 //Add package details
 public void AddPackage(Package package)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Packages.Add(package);  //Adding package into database
         context.SaveChanges();
     }
 }
 //Update package types if required
 public void UpdatePackageType(PackageType packageType)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Entry(packageType).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 //Update Giftcardtypes
 public void UpdateGiftCardType(GiftCardType giftCardType)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Entry(giftCardType).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 //Add the packages types
 public void AddPackageType(PackageType packageType)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.PackageTypes.Add(packageType);
         context.SaveChanges();
     }
 }
 //Add giftcardtyes into database
 public void AddGiftCardType(GiftCardType giftCardType)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.GiftCardTypes.Add(giftCardType);
         context.SaveChanges();
     }
 }
Exemplo n.º 8
0
 //Update itinerary details
 public void UpdateItinerary(Itinerary itinerary)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Entry(itinerary).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 9
0
 //Adding itinerary details in database
 public void AddItinerary(List <Itinerary> itineraries)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         context.Itineraries.AddRange(itineraries);
         context.SaveChanges();
     }
 }
 //Delete package
 public void DeletePackage(int id)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         Package package = GetPackageById(id);
         context.Packages.Attach(package);
         context.Packages.Remove(package); //Removing package from database
         context.SaveChanges();
     }
 }
 //Delete package types
 public void DeletePackageType(int id)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         PackageType packageType = GetPackageTypeById(id);
         context.PackageTypes.Attach(packageType);
         context.PackageTypes.Remove(packageType);
         context.SaveChanges();
     }
 }
 //Delete giftcardtype from database
 public void DeleteGiftCardType(int giftCardTypeId)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         GiftCardType giftCardType = GetGiftCardTypeById(giftCardTypeId);
         context.GiftCardTypes.Attach(giftCardType);
         context.GiftCardTypes.Remove(giftCardType);
         context.SaveChanges();
     }
 }
Exemplo n.º 13
0
 //Delete itinerary details
 public void DeleteItinerary(int id)
 {
     using (OnlineTourismDBContext context = new OnlineTourismDBContext())
     {
         Itinerary itinerary = GetItineraryById(id);
         context.Itineraries.Attach(itinerary);
         context.Itineraries.Remove(itinerary); //Removing itineray details from database
         context.SaveChanges();
     }
 }