Files
win8phoneApp/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
Christian Fiedler 4ecc87f863 #204
2013-11-14 18:18:02 +01:00

65 lines
2.0 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 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;
for (int i = 0; i < this.canteens.Count; i++)
{
if (this.canteens[i].Id.Equals(id))
{
retValue = this.canteens[i];
}
}
return retValue;
}
}
}