Files
yavsc/web/Controllers/HomeController.cs
Paul Schneider 57a473aff8 Many changes :
* JsonReaderError.aspx: display a nice json conversion error

* CalendarEntryList.cs: new Google data for the calendar entries

* JsonReaderError.cs: Json error model

* README.md: Documentation url

* NpgsqlBlogProvider.cs: Update the blog post title

* BlogsController.cs: - Updating the blog post title
- bug fix rendering the avatar

* FrontOfficeController.cs: - the client cannot modify its estimation

* GoogleController.cs: - implementing the calendar entries retrieval

* HomeController.cs: - the home start page from configuration
  parameter named "StartPage"

* Global.asax.cs: - back to a clean global.asax

* style.css: showing the main area with a background transparent color

* Post.aspx: Bug fix: the message was displayed two times (we keep the
  one from app.master)

* UserPost.aspx: the blog title comes from the poster profile found in
  ViewData

* DateQuery.aspx: implementing the date query

* Web.config: the start page now comes from Web.config

* Web.csproj: the Sql db creation script should not be deployed,
  neither as package.config

* BlogManager.cs: updating the blog post title

* BlogProvider.cs: yavscModel/Blogs/BlogManager.cs


* YavscModel.csproj: new cs files to compile

* App.master: returning from the Google login
2015-01-06 10:15:24 +01:00

93 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.Configuration;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Yavsc;
using System.Reflection;
using System.Resources;
using Yavsc.Model;
namespace Yavsc.Controllers
{
public class HomeController : Controller
{
// Site name
private static string name = null;
/// <summary>
/// Gets or sets the site name.
/// </summary>
/// <value>The name.</value>
[Obsolete("Use YavscHelpers.SiteName insteed.")]
public static string Name {
get {
if (name == null)
name = WebConfigurationManager.AppSettings ["Name"];
return name;
}
}
// Administrator email
private static string admail =
WebConfigurationManager.AppSettings ["AdminEmail"];
/// <summary>
/// Gets the Administrator email.
/// </summary>
/// <value>The admail.</value>
public static string Admail {
get {
return admail;
}
}
public ActionResult ReferencedAssemblies()
{
AssemblyName[] model = GetType ().Assembly.GetReferencedAssemblies ();
return View (model);
}
private static string owneremail = null;
/// <summary>
/// Gets or sets the owner email.
/// </summary>
/// <value>The owner email.</value>
public static string OwnerEmail {
get {
if (owneremail == null)
owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail");
return owneremail;
}
set {
owneremail = value;
}
}
public ActionResult Index ()
{
string startPage = WebConfigurationManager.AppSettings ["StartPage"];
if (startPage != null)
Redirect (startPage);
ViewData ["Message"] = LocalizedText.Welcome;
return View ();
}
public ActionResult AOEMail (string reason, string body)
{
// requires valid owner and admin email?
using (System.Net.Mail.MailMessage msg = new MailMessage(owneremail,admail,"Poke : "+reason,body))
{
using (System.Net.Mail.SmtpClient sc = new SmtpClient())
{
sc.Send (msg);
return View ();
}
}
}
}
}