Set password operational
Sitewide plan for status messages
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user