Files
win8phoneApp/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
2013-11-18 15:41:35 +01:00

76 lines
2.4 KiB
C#

//-----------------------------------------------------------------------
// <copyright file="PriceModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using CampusAppWPortalLib8.Model.Settings;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary> A data Model for the price. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
[XmlRoot("root")]
public class PriceModel
{
/// <summary> The canteens. </summary>
private ObservableCollection<PriceCanteenModel> canteens = null;
/// <summary> Initializes a new instance of the PriceModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceModel()
{
this.canteens = new ObservableCollection<PriceCanteenModel>();
}
/// <summary> Gets or sets the canteens. </summary>
/// <value> The canteens. </value>
[XmlArray("Canteens")]
[XmlArrayItem("Canteen")]
public ObservableCollection<PriceCanteenModel> Canteens
{
get
{
return this.canteens;
}
set
{
this.canteens = value;
}
}
/// <summary> Gets a canteen. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="id"> The identifier. </param>
/// <returns> The canteen. </returns>
public PriceCanteenModel GetCanteen(int id)
{
PriceCanteenModel retValue = null;
foreach (PriceCanteenModel prize in this.canteens)
{
if (prize.Id == id)
{
retValue = prize;
break;
}
}
return retValue;
}
/// <summary> Gets a canteen. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
/// <param name="campus"> The campus. </param>
/// <returns> The canteen. </returns>
public PriceCanteenModel GetCanteen(Campus campus)
{
return this.GetCanteen((int)campus - 1);
}
}
}