//-----------------------------------------------------------------------
//
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
//
// Stubbfel
// 15.10.2013
// Implements the abstract HTTP request class
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Utility
{
using System;
using System.Collections.Generic;
using CampusAppWPortalLib8.Model.Utility;
/// abstract Class provides some methods and member for HttpRequest.
/// Stubbfel, 15.10.2013.
public abstract class AbstractHttpRequest
{
#region Member
/// BaseAddress of the webClient.
private string baseAddress;
#endregion
#region property
/// Gets or sets BaseAddress of the webClient.
/// The base address.
protected string BaseAddress
{
get
{
return this.baseAddress;
}
set
{
if (value != this.baseAddress)
{
this.baseAddress = value;
}
}
}
#endregion
#region Methods
/// Method create the Url for the http-get-method.
/// Stubbfel, 15.10.2013.
/// list of parameters.
/// absolute API-Url include GetParameter.
public Uri CreateGetUrl(List parameters)
{
string paramterStr = string.Empty;
string seperator = string.Empty;
foreach (UrlParamModel parameter in parameters)
{
if (string.Empty.Equals(seperator))
{
seperator = parameter.ParamToken;
}
paramterStr += parameter.ToString();
}
string getUrlStr = this.baseAddress + seperator + paramterStr;
return new Uri(getUrlStr, UriKind.Absolute);
}
#endregion
}
}