WIP
This commit is contained in:
parent
f0eaa2ac62
commit
6459ef961c
|
@ -7,14 +7,18 @@ namespace Plattform.Helper
|
|||
{
|
||||
protected override void Seed(Context context)
|
||||
{
|
||||
var cities = GenerateData.CreateCities();
|
||||
//var cities = GenerateData.CreateCities();
|
||||
var types = GenerateData.CreateRoomTypes();
|
||||
|
||||
foreach (var c in cities)
|
||||
//foreach (var c in cities)
|
||||
//{
|
||||
// context.Cities.Add(c);
|
||||
//}
|
||||
foreach (var t in types)
|
||||
{
|
||||
context.Cities.Add(c);
|
||||
context.RoomTypes.Add(t);
|
||||
}
|
||||
context.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,9 +7,30 @@ namespace Plattform.Helper
|
|||
{
|
||||
public static class GenerateData
|
||||
{
|
||||
private static ICollection<City> Cities;
|
||||
public static ICollection<City> CreateCities()
|
||||
private static List<City> Cities = new List<City>();
|
||||
private static List<RoomType> RoomTypes = new List<RoomType>();
|
||||
private static List<string> ListRoomTypes = new List<string>(new string[]
|
||||
{
|
||||
"Single Bed", "Double Bed", "Suite"
|
||||
});
|
||||
private static List<string> ListCities = new List<string>(new string[]
|
||||
{
|
||||
"Bern"
|
||||
});
|
||||
public static List<RoomType> CreateRoomTypes()
|
||||
{
|
||||
foreach (var item in ListRoomTypes)
|
||||
{
|
||||
RoomTypes.Add(new RoomType(item));
|
||||
}
|
||||
return RoomTypes;
|
||||
}
|
||||
public static List<City> CreateCities()
|
||||
{
|
||||
foreach (var item in ListCities)
|
||||
{
|
||||
Cities.Add(new City(item, 3300, "xtz"));
|
||||
}
|
||||
return Cities;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@ namespace Plattform.Models
|
|||
this.Name = airline.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@ namespace Plattform.Models
|
|||
public DateTime From { get; set; }
|
||||
[DataMember]
|
||||
public DateTime To { get; set; }
|
||||
[DataMember]
|
||||
bool Reserved { get; set; }
|
||||
[DataMember]
|
||||
bool Booked { get; set; }
|
||||
public ICollection<Room> Rooms { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,12 @@ namespace Plattform.Models
|
|||
public int ZipCode { get; set; }
|
||||
[DataMember]
|
||||
public string ShortName { get; set; }
|
||||
public City() { }
|
||||
public City(string name, int zipCode, string shortName)
|
||||
{
|
||||
this.Name = name;
|
||||
this.ZipCode = zipCode;
|
||||
this.ShortName = shortName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,4 @@ namespace Plattform.Models
|
|||
this.ToCityShortName = flight.ToCityShortName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ namespace Plattform.Models
|
|||
[DataMember]
|
||||
public City City { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,4 @@ namespace Plattform.Models
|
|||
[DataMember]
|
||||
public ICollection<Availability> Availability { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
namespace Plattform.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class RoomAvailability
|
||||
{
|
||||
[DataMember]
|
||||
public Room Room;
|
||||
[DataMember]
|
||||
public Availability Availability;
|
||||
[DataMember]
|
||||
public Customer Customer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,10 @@ namespace Plattform.Models
|
|||
public int RoomTypeID { get; set; }
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
public RoomType() { }
|
||||
public RoomType(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue