You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/BookingWeb/Models/SubAccountEditViewModel.cs

50 lines
1.5 KiB
C#

3 years ago
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 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<SubAccountEditViewModel>(model);
}
public static SysUser AsModel(this SubAccountEditViewModel model)
{
return Mapper.Map<SysUser>(model);
}
public static SysUser AsModel(this SubAccountEditViewModel model, SysUser user)
{
return Mapper.Map(model, user);
}
}
}