using AutoMapper; using BookingJieFeng.DB.Model; using Resources; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace BookingJieFeng.Models { public class SubAccountEditViewModel { public string GID { get; set; } [Required(ErrorMessageResourceType = typeof(LangSubAccount), ErrorMessageResourceName = "ValidInputName")] public string NAME { get; set; } public string TEL { get; set; } [Required(ErrorMessageResourceType = typeof(LangSubAccount), ErrorMessageResourceName = "ValidInputMobile")] public string MOBILE { get; set; } [Required(ErrorMessageResourceType = typeof(LangSubAccount), ErrorMessageResourceName = "ValidInputPassword")] public string PASSWORD { get; set; } [Required(ErrorMessageResourceType = typeof(LangSubAccount), ErrorMessageResourceName = "ValidInputEmail")] public string EMAIL { get; set; } public string REMARK { get; set; } } public static class SubAccountEditViewModelExt { public static SubAccountEditViewModel AsEditViewModel(this SysUser model) { return Mapper.Map(model); } public static SysUser AsModel(this SubAccountEditViewModel model) { return Mapper.Map(model); } public static SysUser AsModel(this SubAccountEditViewModel model, SysUser user) { return Mapper.Map(model, user); } } }