extend the PlattfromService with GetGenders and GetSalutations

This commit is contained in:
Andreas Zweili 2018-08-28 22:14:16 +02:00
parent 2db7b7c23f
commit bb49d141cd
2 changed files with 35 additions and 5 deletions

View File

@ -21,5 +21,9 @@ namespace Plattform
bool BookSpecialOffer(SpecialOffer offer);
[OperationContract]
bool CancelSpecialOffer(SpecialOffer offer);
[OperationContract]
List<Gender> GetGenders();
[OperationContract]
List<Salutation> GetSaluations();
}
}

View File

@ -17,13 +17,15 @@ namespace Plattform
// Explorer and start debugging.
public class PlattformService : IPlattformService
{
SpecialOfferDB db = new SpecialOfferDB();
SpecialOfferDB offerDB = new SpecialOfferDB();
GenderDB genderDB = new GenderDB();
SalutationDB salutationDB = new SalutationDB();
AirlineServiceClient client = new AirlineServiceClient();
public List<SpecialOffer> GetSpecialOffers()
{
try
{
return db.GetAllSpecialOffers();
return offerDB.GetAllSpecialOffers();
}
catch(Exception e)
{
@ -38,7 +40,7 @@ namespace Plattform
client.BookFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
client.BookFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
offer.Reserverd = true;
db.UpdateSpecialOffer(offer);
offerDB.UpdateSpecialOffer(offer);
return true;
}
catch(Exception e)
@ -52,7 +54,7 @@ namespace Plattform
try
{
offer.Booked = true;
db.UpdateSpecialOffer(offer);
offerDB.UpdateSpecialOffer(offer);
return true;
}
catch(Exception e)
@ -68,7 +70,7 @@ namespace Plattform
client.CancelFlight(offer.FlightTo, offer.Room.RoomType.Capacity);
client.CancelFlight(offer.FlightFrom, offer.Room.RoomType.Capacity);
offer.Reserverd = false;
db.UpdateSpecialOffer(offer);
offerDB.UpdateSpecialOffer(offer);
return true;
}
catch(Exception e)
@ -77,5 +79,29 @@ namespace Plattform
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>();
}
}
}
}