diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs index e1f4dcf1..7ea84ed4 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs @@ -1,12 +1,96 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 17.06.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Model.Utility { - class URLParamModel + /// + /// This class is a Model for the URLParameter like GET-Parameter + /// + public class URLParamModel { + #region Members + + /// + /// Variable of the key + /// + private readonly string key; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter + public URLParamModel(string key) + { + this.key = key; + } + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter> + /// value of the parameter + public URLParamModel(string key, string value) + { + this.key = key; + this.Value = value; + } + #endregion + #region Proberty + + /// + /// Gets or sets the value of the Parameter + /// + public string Value { get; set; } + + /// + /// Gets the key of the parameter + /// + public string Key + { + get + { + return this.key; + } + } + #endregion + + #region Methods + + /// + /// Method check if the parameter is valid + /// + /// true if is it valid, otherwise false + public virtual bool IsParamValid() + { + if (this.key == null || string.Empty.Equals(this.key) || string.Empty.Equals(this.Value)) + { + return false; + } + + return true; + } + + /// + /// Method return a formatted string like Key=Value + /// + /// return formatted string + public override string ToString() + { + if (!this.IsParamValid()) + { + return string.Empty; + } + + return "&" + this.key + "=" + this.Value; + } + #endregion } }