UserViewModels.cs 1.75 KB
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace CWA.CpoOnline.Models
{

	public class CpoUserViewModelWithPassword : CpoUserViewModel
	{
		[Required]
		[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
		[DataType(DataType.Password)]
		[Display(Name = "Password")]
		public string Password { get; set; }

		[DataType(DataType.Password)]
		[Display(Name = "Confirm password")]
		[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
		public string ConfirmPassword { get; set; }
	}

	public class CpoUserViewModel
	{
		public string Id { get; set; }

		[Required]
		[Display(Name = "First name")]
		[StringLength(100, ErrorMessage = "{0} must be at least {2} characters long.", MinimumLength = 2)]
		public string FirstName { get; set; }

		[Required]
		[Display(Name = "Last name")]
		[StringLength(100, ErrorMessage = "{0} must be at least {2} characters long.", MinimumLength = 2)]
		public string LastName { get; set; }

		[Required]
		[EmailAddress]
		[Display(Name = "Email")]
		public string Email { get; set; }

		[Display(Name = "Administrator")]
		public bool IsAdministrator { get; set; }

		[Display(Name = "Created")]
		public DateTime Created { get; set; }

		[Display(Name = "Last Login")]
		public DateTime? LastLogin { get; set; }

		[Display(Name = "Modified")]
		public DateTime? Modified { get; set; }

	}

	public class UserAccessViewModel
	{
		[Key]
		public string UserId { get; set; }

		public CpoUserViewModel User { get; set; }

		public List<string> SectorIdList { get; set; } = new List<string>();
		public List<string> SymbolIdList { get; set; } = new List<string>();
	}
}