remove models which are already define in the service
This commit is contained in:
parent
0e1ef33782
commit
ad230ab0b9
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Plattform.Models;
|
using Plattform.AirlineService;
|
||||||
|
|
||||||
namespace Plattform.DB
|
namespace Plattform.DB
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Plattform.Models;
|
using Plattform.AirlineService;
|
||||||
|
|
||||||
namespace Plattform.DB
|
namespace Plattform.DB
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Plattform.Models;
|
using Plattform.AirlineService;
|
||||||
using Plattform;
|
|
||||||
|
|
||||||
namespace Plattform.DB
|
namespace Plattform.DB
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using Plattform.Models;
|
using Plattform.Models;
|
||||||
using Plattform.Helper;
|
using Plattform.Helper;
|
||||||
|
using Plattform.AirlineService;
|
||||||
|
|
||||||
namespace Plattform.DB
|
namespace Plattform.DB
|
||||||
{
|
{
|
||||||
|
@ -8,53 +9,53 @@ namespace Plattform.DB
|
||||||
{
|
{
|
||||||
public Context() : base("PlattformDB") { }
|
public Context() : base("PlattformDB") { }
|
||||||
|
|
||||||
public DbSet<City> Cities { get; set; }
|
public DbSet<AirlineService.City> Cities { get; set; }
|
||||||
public DbSet<Airline> Airlines { get; set; }
|
public DbSet<AirlineService.Airline> Airlines { get; set; }
|
||||||
public DbSet<Flight> Flights { get; set; }
|
public DbSet<AirlineService.Flight> Flights { get; set; }
|
||||||
public DbSet<Hotel> Hotels { get; set; }
|
public DbSet<Hotel> Hotels { get; set; }
|
||||||
public DbSet<Room> Rooms { get; set; }
|
public DbSet<Room> Rooms { get; set; }
|
||||||
public DbSet<RoomType> RoomTypes { get; set; }
|
public DbSet<RoomType> RoomTypes { get; set; }
|
||||||
public DbSet<Availability> Availabilities { get; set; }
|
public DbSet<Availability> Availabilities { get; set; }
|
||||||
public DbSet<Airport> Airports { get; set; }
|
public DbSet<AirlineService.Airport> Airports { get; set; }
|
||||||
public DbSet<Gender> Genders { get; set; }
|
public DbSet<Gender> Genders { get; set; }
|
||||||
public DbSet<Salutation> Salutations { get; set; }
|
public DbSet<Salutation> Salutations { get; set; }
|
||||||
public DbSet<SpecialOffer> SpecialOffers { get; set; }
|
public DbSet<SpecialOffer> SpecialOffers { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<City>()
|
modelBuilder.Entity<AirlineService.City>()
|
||||||
.Property(c => c.Name)
|
.Property(c => c.Name)
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
modelBuilder.Entity<City>()
|
modelBuilder.Entity<AirlineService.City>()
|
||||||
.Property(c => c.ZipCode)
|
.Property(c => c.ZipCode)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
modelBuilder.Entity<Airline>()
|
modelBuilder.Entity<AirlineService.Airline>()
|
||||||
.Property(a => a.AirlineID)
|
.Property(a => a.AirlineID)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
modelBuilder.Entity<Airline>()
|
modelBuilder.Entity<AirlineService.Airline>()
|
||||||
.Property(a => a.Name)
|
.Property(a => a.Name)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
modelBuilder.Entity<Flight>()
|
modelBuilder.Entity<AirlineService.Flight>()
|
||||||
.Property(f => f.Name)
|
.Property(f => f.Name)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
modelBuilder.Entity<Flight>()
|
modelBuilder.Entity<AirlineService.Flight>()
|
||||||
.Property(f => f.Duration)
|
.Property(f => f.Duration)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
modelBuilder.Entity<Flight>()
|
modelBuilder.Entity<AirlineService.Flight>()
|
||||||
.Property(f => f.StartTime)
|
.Property(f => f.StartTime)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
modelBuilder.Entity<Airport>()
|
modelBuilder.Entity<AirlineService.Airport>()
|
||||||
.HasKey(f => f.ShortName);
|
.HasKey(f => f.ShortName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Plattform.Models;
|
using Plattform.AirlineService;
|
||||||
|
|
||||||
namespace Plattform.DB
|
namespace Plattform.DB
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Plattform.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Airline
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int AirlineID { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public Airline(){ }
|
|
||||||
public Airline(AirlineService.Airline airline)
|
|
||||||
{
|
|
||||||
this.Name = airline.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Plattform.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Airport
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public string ShortName { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public virtual City City { get; set; }
|
|
||||||
|
|
||||||
public Airport() { }
|
|
||||||
public Airport(AirlineService.Airport airport)
|
|
||||||
{
|
|
||||||
City city = new City
|
|
||||||
{
|
|
||||||
Name = airport.City.Name,
|
|
||||||
ZipCode = airport.City.ZipCode,
|
|
||||||
};
|
|
||||||
this.Name = airport.Name;
|
|
||||||
this.City = city;
|
|
||||||
this.ShortName = airport.ShortName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Plattform.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class City
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int CityID { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public int ZipCode { get; set; }
|
|
||||||
public City() { }
|
|
||||||
public City(string name, int zipCode)
|
|
||||||
{
|
|
||||||
this.Name = name;
|
|
||||||
this.ZipCode = zipCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using Plattform;
|
|
||||||
|
|
||||||
namespace Plattform.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Flight
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int FlightID { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public virtual Airline Airline { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public DateTime StartTime { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public float Duration { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public virtual Airport Origin { get; set; }
|
|
||||||
[DataMember]
|
|
||||||
public virtual Airport Destination { get; set; }
|
|
||||||
|
|
||||||
public Flight(AirlineService.Flight flight)
|
|
||||||
{
|
|
||||||
Airport origin = new Airport(flight.Origin);
|
|
||||||
Airport destination = new Airport(flight.Destination);
|
|
||||||
this.Airline = new Airline(flight.Airline);
|
|
||||||
this.Name = flight.Name;
|
|
||||||
this.StartTime = flight.StartTime;
|
|
||||||
this.Duration = flight.Duration;
|
|
||||||
this.Origin = origin;
|
|
||||||
this.Destination = destination;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
using Plattform;
|
||||||
|
|
||||||
namespace Plattform.Models
|
namespace Plattform.Models
|
||||||
{
|
{
|
||||||
|
@ -10,6 +11,6 @@ namespace Plattform.Models
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public virtual City City { get; set; }
|
public virtual AirlineService.City City { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
using Plattform.AirlineService;
|
||||||
|
|
||||||
namespace Plattform.Models
|
namespace Plattform.Models
|
||||||
{
|
{
|
||||||
|
@ -10,7 +11,9 @@ namespace Plattform.Models
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SpecialOfferID { get; set; }
|
public int SpecialOfferID { get; set; }
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public virtual Flight Flight { get; set; }
|
public virtual Flight FlightTo { get; set; }
|
||||||
|
[DataMember]
|
||||||
|
public virtual Flight FlightFrom { get; set; }
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public virtual Person Customer { get; set; }
|
public virtual Person Customer { get; set; }
|
||||||
[DataMember]
|
[DataMember]
|
||||||
|
@ -25,9 +28,10 @@ namespace Plattform.Models
|
||||||
public bool Booked { get; set; }
|
public bool Booked { get; set; }
|
||||||
|
|
||||||
public SpecialOffer() { }
|
public SpecialOffer() { }
|
||||||
public SpecialOffer(Flight flight, Room room, float price)
|
public SpecialOffer(Flight flightTo, Flight flightFrom, Room room, float price)
|
||||||
{
|
{
|
||||||
this.Flight = flight;
|
this.FlightTo = flightTo;
|
||||||
|
this.FlightFrom = flightFrom;
|
||||||
this.Room = room;
|
this.Room = room;
|
||||||
this.Price = price;
|
this.Price = price;
|
||||||
this.Reserverd = false;
|
this.Reserverd = false;
|
||||||
|
|
Loading…
Reference in New Issue