48 lines
1022 B
C#
48 lines
1022 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using LeafWeb.Core.DAL;
|
|
|
|
namespace LeafWeb.Web.Controllers
|
|
{
|
|
//[UserActivity]
|
|
public class ControllerBase : Controller
|
|
{
|
|
protected readonly DataService DataService = new DataService();
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
DataService.Dispose();
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
protected bool IsHttpParamActionMatch()
|
|
{
|
|
return ControllerContext.RouteData.Values["action"].ToString()
|
|
.Equals("Action", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
protected enum StatusType
|
|
{
|
|
Info,
|
|
Success,
|
|
Error
|
|
}
|
|
|
|
protected void SetStatusMessage(string msg, StatusType statusType = StatusType.Info)
|
|
{
|
|
TempData["StatusMessage"] = msg;
|
|
switch (statusType)
|
|
{
|
|
case StatusType.Success:
|
|
TempData["StatusMessage-Type"] = "alert-success";
|
|
break;
|
|
case StatusType.Error:
|
|
TempData["StatusMessage-Type"] = "alert-error";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |