using System;
using System.Configuration;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Linq.Expressions;
using Yavsc.Model.Circles;
namespace Yavsc.Helpers
{
///
/// Link.
///
public class Link {
///
/// Gets or sets the text.
///
/// The text.
public string Text { get; set; }
///
/// Gets or sets the URL.
///
/// The URL.
public string Url { get; set; }
///
/// Gets or sets the image.
///
/// The image.
public string Image { get; set; }
}
///
/// Thanks helper.
///
public static class ThanksHelper {
static private ThanksConfigurationSection configurationSection=null;
///
/// Gets the configuration section.
///
/// The configuration section.
static public ThanksConfigurationSection ConfigurationSection {
get {
if (configurationSection==null)
configurationSection = (ThanksConfigurationSection) ConfigurationManager.GetSection ("system.web/thanks");
return configurationSection;
}
}
///
/// Html code for each entry
///
public static Link[] Thanks (this HtmlHelper helper)
{
List result = new List() ;
if (ConfigurationSection == null) return result.ToArray();
if (ConfigurationSection.To == null) return result.ToArray();
foreach (ThanksConfigurationElement e in ConfigurationSection.To)
result.Add( new Link { Url = e.Url, Image=e.Image, Text = e.Name });
return result.ToArray();
}
}
}