2011-01-15 09:33:29 -08:00
|
|
|
using System.Collections.Generic;
|
2009-11-10 17:33:39 +00:00
|
|
|
using System.Linq;
|
2011-02-07 17:26:00 -08:00
|
|
|
using System.Text.RegularExpressions;
|
2009-11-10 03:41:01 +00:00
|
|
|
using System.Web.Mvc;
|
2011-01-17 17:47:05 -08:00
|
|
|
using System.Web.Routing;
|
2009-12-21 20:29:53 +00:00
|
|
|
using Orchard.ContentManagement;
|
2011-01-15 09:33:29 -08:00
|
|
|
using Orchard.Core.Common.Models;
|
|
|
|
using Orchard.Core.Contents.Controllers;
|
2010-11-20 12:10:47 -08:00
|
|
|
using Orchard.Core.Settings.Models;
|
2010-09-03 16:04:42 -07:00
|
|
|
using Orchard.DisplayManagement;
|
2010-04-15 21:53:32 -07:00
|
|
|
using Orchard.Localization;
|
2009-11-12 03:46:14 +00:00
|
|
|
using Orchard.Security;
|
2009-11-12 19:19:45 +00:00
|
|
|
using Orchard.UI.Notify;
|
2009-11-10 17:33:39 +00:00
|
|
|
using Orchard.Users.Models;
|
2010-03-02 17:23:45 -08:00
|
|
|
using Orchard.Users.Services;
|
2009-11-10 17:33:39 +00:00
|
|
|
using Orchard.Users.ViewModels;
|
2010-09-01 14:39:28 -07:00
|
|
|
using Orchard.Mvc.Extensions;
|
2010-11-20 12:10:47 -08:00
|
|
|
using System;
|
|
|
|
using Orchard.Settings;
|
2011-01-15 09:33:29 -08:00
|
|
|
using Orchard.UI.Navigation;
|
2009-11-10 03:41:01 +00:00
|
|
|
|
|
|
|
namespace Orchard.Users.Controllers {
|
2010-06-06 14:58:27 -07:00
|
|
|
[ValidateInput(false)]
|
2009-11-19 05:31:39 +00:00
|
|
|
public class AdminController : Controller, IUpdateModel {
|
2009-11-17 05:52:23 +00:00
|
|
|
private readonly IMembershipService _membershipService;
|
2010-03-02 17:23:45 -08:00
|
|
|
private readonly IUserService _userService;
|
2010-11-20 12:10:47 -08:00
|
|
|
private readonly ISiteService _siteService;
|
2009-11-10 17:33:39 +00:00
|
|
|
|
|
|
|
public AdminController(
|
2009-12-21 01:30:24 +00:00
|
|
|
IOrchardServices services,
|
2010-03-02 17:23:45 -08:00
|
|
|
IMembershipService membershipService,
|
2010-09-03 16:04:42 -07:00
|
|
|
IUserService userService,
|
2010-11-20 12:10:47 -08:00
|
|
|
IShapeFactory shapeFactory,
|
|
|
|
ISiteService siteService) {
|
2009-12-21 01:30:24 +00:00
|
|
|
Services = services;
|
2009-11-17 05:52:23 +00:00
|
|
|
_membershipService = membershipService;
|
2010-03-02 17:23:45 -08:00
|
|
|
_userService = userService;
|
2010-11-20 12:10:47 -08:00
|
|
|
_siteService = siteService;
|
|
|
|
|
2009-11-14 05:35:58 +00:00
|
|
|
T = NullLocalizer.Instance;
|
2010-10-15 17:24:30 -07:00
|
|
|
Shape = shapeFactory;
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
|
|
|
|
2010-09-03 16:04:42 -07:00
|
|
|
dynamic Shape { get; set; }
|
2009-12-21 01:30:24 +00:00
|
|
|
public IOrchardServices Services { get; set; }
|
2009-11-14 05:35:58 +00:00
|
|
|
public Localizer T { get; set; }
|
2009-11-12 19:56:13 +00:00
|
|
|
|
2011-01-15 09:33:29 -08:00
|
|
|
public ActionResult Index(UserIndexOptions options, PagerParameters pagerParameters) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to list users")))
|
2010-01-22 05:25:54 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2011-01-15 09:33:29 -08:00
|
|
|
var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
|
|
|
|
|
|
|
// default options
|
|
|
|
if (options == null)
|
|
|
|
options = new UserIndexOptions();
|
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
var users = Services.ContentManager
|
2011-01-15 09:33:29 -08:00
|
|
|
.Query<UserPart, UserPartRecord>();
|
|
|
|
|
|
|
|
switch (options.Filter) {
|
|
|
|
case UsersFilter.Approved:
|
|
|
|
users = users.Where(u => u.RegistrationStatus == UserStatus.Approved);
|
|
|
|
break;
|
|
|
|
case UsersFilter.Pending:
|
|
|
|
users = users.Where(u => u.RegistrationStatus == UserStatus.Pending);
|
|
|
|
break;
|
|
|
|
case UsersFilter.EmailPending:
|
2011-02-09 08:37:47 -08:00
|
|
|
users = users.Where(u => u.EmailStatus == UserStatus.Pending);
|
2011-01-15 09:33:29 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!String.IsNullOrWhiteSpace(options.Search)) {
|
|
|
|
users = users.Where(u => u.UserName.Contains(options.Search) || u.Email.Contains(options.Search));
|
|
|
|
}
|
|
|
|
|
|
|
|
var pagerShape = Shape.Pager(pager).TotalItemCount(users.Count());
|
|
|
|
|
|
|
|
switch (options.Order) {
|
|
|
|
case UsersOrder.Name:
|
|
|
|
users = users.OrderBy(u => u.UserName);
|
|
|
|
break;
|
|
|
|
case UsersOrder.Email:
|
|
|
|
users = users.OrderBy(u => u.Email);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
var results = users
|
|
|
|
.Slice(pager.GetStartIndex(), pager.PageSize)
|
|
|
|
.ToList();
|
2009-11-26 01:17:48 +00:00
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
var model = new UsersIndexViewModel {
|
2011-01-15 09:33:29 -08:00
|
|
|
Users = results
|
|
|
|
.Select(x => new UserEntry { User = x.Record })
|
|
|
|
.ToList(),
|
|
|
|
Options = options,
|
|
|
|
Pager = pagerShape
|
2009-12-21 01:30:24 +00:00
|
|
|
};
|
2009-11-10 17:33:39 +00:00
|
|
|
|
2011-01-17 17:47:05 -08:00
|
|
|
// maintain previous route data when generating page links
|
|
|
|
var routeData = new RouteData();
|
|
|
|
routeData.Values.Add("Options.Filter", options.Filter);
|
|
|
|
routeData.Values.Add("Options.Search", options.Search);
|
|
|
|
routeData.Values.Add("Options.Order", options.Order);
|
|
|
|
|
|
|
|
pagerShape.RouteData(routeData);
|
|
|
|
|
2010-09-09 17:02:04 -07:00
|
|
|
return View(model);
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
|
|
|
|
2011-01-15 09:33:29 -08:00
|
|
|
[HttpPost]
|
|
|
|
[FormValueRequired("submit.BulkEdit")]
|
|
|
|
public ActionResult Index(FormCollection input) {
|
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
|
|
|
var viewModel = new UsersIndexViewModel {Users = new List<UserEntry>(), Options = new UserIndexOptions()};
|
|
|
|
UpdateModel(viewModel);
|
|
|
|
|
|
|
|
var checkedEntries = viewModel.Users.Where(c => c.IsChecked);
|
|
|
|
switch (viewModel.Options.BulkAction) {
|
|
|
|
case UsersBulkAction.None:
|
|
|
|
break;
|
|
|
|
case UsersBulkAction.Approve:
|
|
|
|
foreach (var entry in checkedEntries) {
|
|
|
|
Approve(entry.User.Id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case UsersBulkAction.Disable:
|
|
|
|
foreach (var entry in checkedEntries) {
|
|
|
|
Moderate(entry.User.Id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case UsersBulkAction.ChallengeEmail:
|
|
|
|
foreach (var entry in checkedEntries) {
|
|
|
|
SendChallengeEmail(entry.User.Id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case UsersBulkAction.Delete:
|
|
|
|
foreach (var entry in checkedEntries) {
|
|
|
|
Delete(entry.User.Id);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-01-17 07:22:49 -08:00
|
|
|
return Index(viewModel.Options, new PagerParameters());
|
2011-01-15 09:33:29 -08:00
|
|
|
}
|
|
|
|
|
2009-11-10 17:33:39 +00:00
|
|
|
public ActionResult Create() {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-01-22 05:25:54 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2010-09-02 15:11:33 -07:00
|
|
|
var user = Services.ContentManager.New<IUser>("User");
|
2010-11-05 14:53:55 -07:00
|
|
|
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Create", Model: new UserCreateViewModel(), Prefix: null);
|
|
|
|
editor.Metadata.Position = "2";
|
2010-11-17 22:56:52 -08:00
|
|
|
dynamic model = Services.ContentManager.BuildEditor(user);
|
2010-11-05 14:53:55 -07:00
|
|
|
model.Content.Add(editor);
|
|
|
|
|
2010-11-19 17:42:30 -08:00
|
|
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
2010-11-17 22:56:52 -08:00
|
|
|
return View((object)model);
|
2009-11-10 03:41:01 +00:00
|
|
|
}
|
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
[HttpPost, ActionName("Create")]
|
2010-11-05 14:53:55 -07:00
|
|
|
public ActionResult CreatePOST(UserCreateViewModel createModel) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-01-22 05:25:54 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
2009-12-21 01:30:24 +00:00
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
if (!string.IsNullOrEmpty(createModel.UserName)) {
|
2010-12-08 18:18:52 -08:00
|
|
|
if (!_userService.VerifyUserUnicity(createModel.UserName, createModel.Email)) {
|
|
|
|
AddModelError("NotUniqueUserName", T("User with that username and/or email already exists."));
|
2010-11-05 14:53:55 -07:00
|
|
|
}
|
2010-03-04 13:25:22 -08:00
|
|
|
}
|
2011-02-07 17:26:00 -08:00
|
|
|
|
|
|
|
if (!Regex.IsMatch(createModel.Email ?? "", UserPart.EmailPattern, RegexOptions.IgnoreCase)) {
|
|
|
|
// http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
|
|
|
|
ModelState.AddModelError("Email", T("You must specify a valid email address."));
|
|
|
|
}
|
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
if (createModel.Password != createModel.ConfirmPassword) {
|
2010-04-16 12:47:06 -07:00
|
|
|
AddModelError("ConfirmPassword", T("Password confirmation must match"));
|
2009-12-21 01:30:24 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
var user = Services.ContentManager.New<IUser>("User");
|
|
|
|
if (ModelState.IsValid) {
|
|
|
|
user = _membershipService.CreateUser(new CreateUserParams(
|
|
|
|
createModel.UserName,
|
|
|
|
createModel.Password,
|
|
|
|
createModel.Email,
|
|
|
|
null, null, true));
|
|
|
|
}
|
2010-03-02 12:38:54 -08:00
|
|
|
|
2010-11-18 11:21:43 -08:00
|
|
|
dynamic model = Services.ContentManager.UpdateEditor(user, this);
|
2010-03-02 12:38:54 -08:00
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
if (!ModelState.IsValid) {
|
2009-12-21 01:30:24 +00:00
|
|
|
Services.TransactionManager.Cancel();
|
2010-11-05 14:53:55 -07:00
|
|
|
|
|
|
|
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Create", Model: createModel, Prefix: null);
|
|
|
|
editor.Metadata.Position = "2";
|
|
|
|
model.Content.Add(editor);
|
|
|
|
|
2010-11-19 17:42:30 -08:00
|
|
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
2010-11-18 11:21:43 -08:00
|
|
|
return View((object)model);
|
2009-11-27 05:12:52 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
Services.Notifier.Information(T("User created"));
|
2011-01-15 09:33:29 -08:00
|
|
|
return RedirectToAction("Index");
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public ActionResult Edit(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-01-22 05:25:54 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
2010-10-05 14:45:12 -07:00
|
|
|
|
|
|
|
var user = Services.ContentManager.Get<UserPart>(id);
|
2010-11-05 14:53:55 -07:00
|
|
|
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Edit", Model: new UserEditViewModel {User = user}, Prefix: null);
|
|
|
|
editor.Metadata.Position = "2";
|
2010-11-17 22:56:52 -08:00
|
|
|
dynamic model = Services.ContentManager.BuildEditor(user);
|
2010-11-05 14:53:55 -07:00
|
|
|
model.Content.Add(editor);
|
2010-10-05 14:45:12 -07:00
|
|
|
|
2010-11-19 17:42:30 -08:00
|
|
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
2010-11-17 22:56:52 -08:00
|
|
|
return View((object)model);
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
[HttpPost, ActionName("Edit")]
|
2010-01-22 05:25:54 +00:00
|
|
|
public ActionResult EditPOST(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-01-22 05:25:54 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
2010-10-05 14:45:12 -07:00
|
|
|
|
2010-11-20 12:10:47 -08:00
|
|
|
var user = Services.ContentManager.Get<UserPart>(id);
|
|
|
|
string previousName = user.UserName;
|
|
|
|
|
2010-11-18 11:21:43 -08:00
|
|
|
dynamic model = Services.ContentManager.UpdateEditor(user, this);
|
2009-11-13 00:19:43 +00:00
|
|
|
|
2010-11-05 14:53:55 -07:00
|
|
|
var editModel = new UserEditViewModel {User = user};
|
2010-11-20 12:10:47 -08:00
|
|
|
if (TryUpdateModel(editModel)) {
|
2010-12-08 18:18:52 -08:00
|
|
|
if (!_userService.VerifyUserUnicity(id, editModel.UserName, editModel.Email)) {
|
|
|
|
AddModelError("NotUniqueUserName", T("User with that username and/or email already exists."));
|
2010-11-05 14:53:55 -07:00
|
|
|
}
|
2011-02-07 17:26:00 -08:00
|
|
|
else if (!Regex.IsMatch(editModel.Email ?? "", UserPart.EmailPattern, RegexOptions.IgnoreCase)) {
|
|
|
|
// http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
|
|
|
|
ModelState.AddModelError("Email", T("You must specify a valid email address."));
|
|
|
|
}
|
2010-11-20 12:10:47 -08:00
|
|
|
else {
|
|
|
|
// also update the Super user if this is the renamed account
|
|
|
|
if (String.Equals(Services.WorkContext.CurrentSite.SuperUser, previousName, StringComparison.OrdinalIgnoreCase)) {
|
|
|
|
_siteService.GetSiteSettings().As<SiteSettingsPart>().SuperUser = editModel.UserName;
|
|
|
|
}
|
|
|
|
|
|
|
|
user.NormalizedUserName = editModel.UserName.ToLower();
|
|
|
|
}
|
2010-03-01 19:06:28 -08:00
|
|
|
}
|
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
if (!ModelState.IsValid) {
|
|
|
|
Services.TransactionManager.Cancel();
|
2010-11-05 14:53:55 -07:00
|
|
|
|
|
|
|
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Edit", Model: editModel, Prefix: null);
|
|
|
|
editor.Metadata.Position = "2";
|
|
|
|
model.Content.Add(editor);
|
|
|
|
|
2010-11-19 17:42:30 -08:00
|
|
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
2010-11-18 11:21:43 -08:00
|
|
|
return View((object)model);
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
2009-11-14 02:35:43 +00:00
|
|
|
|
2009-12-21 01:30:24 +00:00
|
|
|
Services.Notifier.Information(T("User information updated"));
|
2011-01-15 09:33:29 -08:00
|
|
|
return RedirectToAction("Index");
|
2009-11-10 17:33:39 +00:00
|
|
|
}
|
2009-11-12 03:46:14 +00:00
|
|
|
|
2010-01-27 20:39:35 +00:00
|
|
|
public ActionResult Delete(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-01-27 20:39:35 +00:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2010-11-20 12:10:47 -08:00
|
|
|
var user = Services.ContentManager.Get<IUser>(id);
|
|
|
|
|
|
|
|
if (user != null) {
|
|
|
|
if (String.Equals(Services.WorkContext.CurrentSite.SuperUser, user.UserName, StringComparison.OrdinalIgnoreCase)) {
|
|
|
|
Services.Notifier.Error(T("The Super user can't be removed. Please disable this account or specify another Super user account"));
|
|
|
|
}
|
|
|
|
else if (String.Equals(Services.WorkContext.CurrentUser.UserName, user.UserName, StringComparison.OrdinalIgnoreCase)) {
|
|
|
|
Services.Notifier.Error(T("You can't remove your own account. Please log in with another account"));
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Services.ContentManager.Remove(user.ContentItem);
|
2011-01-15 09:33:29 -08:00
|
|
|
Services.Notifier.Information(T("User {0} deleted", user.UserName));
|
2010-11-20 12:10:47 -08:00
|
|
|
}
|
|
|
|
}
|
2010-01-27 20:39:35 +00:00
|
|
|
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
}
|
|
|
|
|
2010-09-01 18:18:53 -07:00
|
|
|
public ActionResult SendChallengeEmail(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-09-01 18:18:53 -07:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2011-01-15 09:33:29 -08:00
|
|
|
var user = Services.ContentManager.Get<IUser>(id);
|
2010-09-01 18:18:53 -07:00
|
|
|
|
|
|
|
if ( user != null ) {
|
2010-11-28 18:34:13 -08:00
|
|
|
_userService.SendChallengeEmail(user.As<UserPart>(), nonce => Url.AbsoluteAction(() => Url.Action("ChallengeEmail", "Account", new {Area = "Orchard.Users", nonce = nonce})));
|
2011-01-15 09:33:29 -08:00
|
|
|
Services.Notifier.Information(T("Challenge email sent to {0}", user.UserName));
|
2010-09-01 18:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
}
|
|
|
|
|
2010-08-31 13:20:41 -07:00
|
|
|
public ActionResult Approve(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-08-31 13:20:41 -07:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2011-01-15 09:33:29 -08:00
|
|
|
var user = Services.ContentManager.Get<IUser>(id);
|
2010-08-31 13:20:41 -07:00
|
|
|
|
|
|
|
if ( user != null ) {
|
|
|
|
user.As<UserPart>().RegistrationStatus = UserStatus.Approved;
|
2011-01-15 09:33:29 -08:00
|
|
|
Services.Notifier.Information(T("User {0} approved", user.UserName));
|
2010-08-31 13:20:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
}
|
|
|
|
|
|
|
|
public ActionResult Moderate(int id) {
|
2010-12-08 14:24:35 -08:00
|
|
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
2010-08-31 13:20:41 -07:00
|
|
|
return new HttpUnauthorizedResult();
|
|
|
|
|
2010-11-20 12:10:47 -08:00
|
|
|
var user = Services.ContentManager.Get<IUser>(id);
|
2010-08-31 13:20:41 -07:00
|
|
|
|
2010-11-20 12:10:47 -08:00
|
|
|
if (user != null) {
|
|
|
|
if (String.Equals(Services.WorkContext.CurrentUser.UserName, user.UserName, StringComparison.OrdinalIgnoreCase)) {
|
|
|
|
Services.Notifier.Error(T("You can't disable your own account. Please log in with another account"));
|
2010-08-31 13:20:41 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
user.As<UserPart>().RegistrationStatus = UserStatus.Pending;
|
2010-11-20 12:10:47 -08:00
|
|
|
Services.Notifier.Information(T("User {0} disabled", user.UserName));
|
2010-08-31 13:20:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return RedirectToAction("Index");
|
|
|
|
}
|
|
|
|
|
2009-11-19 05:31:39 +00:00
|
|
|
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
2009-11-13 00:19:43 +00:00
|
|
|
return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
|
|
|
|
}
|
2010-04-16 12:47:06 -07:00
|
|
|
|
|
|
|
public void AddModelError(string key, LocalizedString errorMessage) {
|
|
|
|
ModelState.AddModelError(key, errorMessage.ToString());
|
|
|
|
}
|
2009-11-10 03:41:01 +00:00
|
|
|
}
|
2009-11-10 17:33:39 +00:00
|
|
|
|
2009-11-10 03:41:01 +00:00
|
|
|
}
|