extend the PlattfromService with GetGenders and GetSalutations
This commit is contained in:
parent
2db7b7c23f
commit
bb49d141cd
|
@ -21,5 +21,9 @@ namespace Plattform
|
||||||
bool BookSpecialOffer(SpecialOffer offer);
|
bool BookSpecialOffer(SpecialOffer offer);
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
bool CancelSpecialOffer(SpecialOffer offer);
|
bool CancelSpecialOffer(SpecialOffer offer);
|
||||||
|
[OperationContract]
|
||||||
|
List<Gender> GetGenders();
|
||||||
|
[OperationContract]
|
||||||
|
List<Salutation> GetSaluations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,15 @@ namespace Plattform
|
||||||
// Explorer and start debugging.
|
// Explorer and start debugging.
|
||||||
public class PlattformService : IPlattformService
|
public class PlattformService : IPlattformService
|
||||||
{
|
{
|
||||||
SpecialOfferDB db = new SpecialOfferDB();
|
SpecialOfferDB offerDB = new SpecialOfferDB();
|
||||||
|
GenderDB genderDB = new GenderDB();
|
||||||
|
SalutationDB salutationDB = new SalutationDB();
|
||||||
AirlineServiceClient client = new AirlineServiceClient();
|
AirlineServiceClient client = new AirlineServiceClient();
|
||||||
public List<SpecialOffer> GetSpecialOffers()
|
public List<SpecialOffer> GetSpecialOffers()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return db.GetAllSpecialOffers();
|
return offerDB.GetAllSpecialOffers();
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +40,7 @@ namespace Plattform
|
||||||
client.BookFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
|
client.BookFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
|
||||||
client.BookFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
|
client.BookFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
|
||||||
offer.Reserverd = true;
|
offer.Reserverd = true;
|
||||||
db.UpdateSpecialOffer(offer);
|
offerDB.UpdateSpecialOffer(offer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -52,7 +54,7 @@ namespace Plattform
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
offer.Booked = true;
|
offer.Booked = true;
|
||||||
db.UpdateSpecialOffer(offer);
|
offerDB.UpdateSpecialOffer(offer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -68,7 +70,7 @@ namespace Plattform
|
||||||
client.CancelFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
|
client.CancelFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
|
||||||
client.CancelFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
|
client.CancelFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
|
||||||
offer.Reserverd = false;
|
offer.Reserverd = false;
|
||||||
db.UpdateSpecialOffer(offer);
|
offerDB.UpdateSpecialOffer(offer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -77,5 +79,29 @@ namespace Plattform
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public List<Gender> GetGender()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return genderDB.GetAllGenders();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Trace.WriteLine(e);
|
||||||
|
return new List<Gender>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<Salutation> GetSalutations()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return salutationDB.GetAllSalutations();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Trace.WriteLine(e);
|
||||||
|
return new List<Salutation>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue