using AutoMapper; using BookingWeb.DB.Model; using Resources; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace BookingWeb.Models { public class UserRegistViewModel { [Required(ErrorMessageResourceType = typeof(LangReg), ErrorMessageResourceName = "ValidInputName")] public string NAME { get; set; } //public string TEL { get; set; } [Required(ErrorMessageResourceType = typeof(LangReg), ErrorMessageResourceName = "ValidInputMobile")] public string MOBILE { get; set; } [Required(ErrorMessageResourceType = typeof(LangReg), ErrorMessageResourceName = "ValidPassword")] public string PASSWORD { get; set; } public string EMAIL { get; set; } [Required(ErrorMessageResourceType = typeof(LangReg), ErrorMessageResourceName = "ValidCompanyName")] public string COMPANY_NAME { get; set; } public string Captcha { get; set; } public string MobileCode { get; set; } } public static class UserRegistExt { public static SysUser AsModel(this UserRegistViewModel viewModel) { return Mapper.Map(viewModel); } public static SysUser AsModel(this UserRegistViewModel viewModel, SysUser model) { return Mapper.Map(viewModel, model); } } }