Leaf Input Details
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.Entities;
|
||||
|
||||
namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
public class LeafInputDetails
|
||||
{
|
||||
[Display(Name = "Name")]
|
||||
[Required(ErrorMessage = "Name required")]
|
||||
[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Please provide full name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Display(Name = "Email address")]
|
||||
[Required(ErrorMessage = "An email address is required")]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Display(Name = "Identifier")]
|
||||
[Required(ErrorMessage = "A unique identifier is required")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[Display(Name = "Site Id")]
|
||||
[Required(ErrorMessage = "The site's name is required")]
|
||||
public string SiteId { get; set; }
|
||||
|
||||
[Display(Name = "Photosyn. Pathway")]
|
||||
[Required(ErrorMessage = "A Photosynthetic pathway must be chosen")]
|
||||
public string PhotosynthesisType { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
[Required]
|
||||
public DateTime Added { get; set; }
|
||||
|
||||
[UIHint("Status")]
|
||||
public string CurrentStatus { get; set; }
|
||||
|
||||
[UIHint("LeafInputStatusViewModels")]
|
||||
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
|
||||
|
||||
static LeafInputDetails()
|
||||
{
|
||||
Mapper.CreateMap<LeafInputStatusType, string>().ConvertUsing(st => st.ToString());
|
||||
Mapper.CreateMap<LeafInputStatusType, LeafInputStatus>().ConvertUsing(st => new LeafInputStatus());
|
||||
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>();
|
||||
Mapper.CreateMap<LeafInput, LeafInputDetails>();
|
||||
}
|
||||
|
||||
public LeafInputDetails(LeafInput leafInput)
|
||||
{
|
||||
Mapper.Map(leafInput, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user