Set password operational

Sitewide plan for status messages
This commit is contained in:
2012-12-29 20:41:50 -05:00
parent ce6fd9c215
commit 8739251066
32 changed files with 332 additions and 144 deletions
+5 -20
View File
@@ -1,13 +1,10 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using MileageTraker.Web.Attributes;
using MileageTraker.Web.DAL;
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels.User
{
public class CreateUserViewModel
public class CreateUserViewModel : RolesViewModel
{
[Required]
[StringLength(64)]
@@ -28,25 +25,13 @@ namespace MileageTraker.Web.ViewModels.User
[Required, DataType(DataType.Password)]
[StringLength(16, MinimumLength = 6)]
[InputSize("medium")]
public string Password { get; set; }
public string[] Roles { get; set; }
public IList<string> AvailableRoles { get; set; }
public IList<string> SelectedRoles { get; set; }
static CreateUserViewModel()
{
Mapper.CreateMap<CreateUserViewModel, Models.User>();
Mapper.CreateMap<string, Role>()
.ConvertUsing(
roleName =>
{
using (var ds = new DataService())
{
return ds.GetRoleByName(roleName);
}
});
Mapper.CreateMap<CreateUserViewModel, Models.User>()
.ForMember(vm => vm.Roles, opt => opt.Ignore());
}
public Models.User ToUser()