using AutoMapper; using DSWeb.Areas.Dispatch.DB; using System; using System.Collections.Generic; using System.Linq; using System.Web; using DSWeb.Areas.Storage.DB; namespace DSWeb.Areas.Storage.Models { public class UserRegistViewModel { public string Name { get; set; } public string Mobile { get; set; } public string OpenId { get; set; } public string COMPANY_NAME { get; set; } } public static class UserRegistExt { public static UserRegistInfo AsDriverInfo(this UserRegistViewModel model) { var result = new UserRegistInfo(); result.GID = Guid.NewGuid().ToString(); result.Name = model.Name; result.OpenId = model.OpenId; result.COMPANY_NAME = model.COMPANY_NAME; result.Mobile = model.Mobile; return result; //return Mapper.Map(model); } public static UserRegistInfo AsDriverInfo(this UserRegistViewModel model, UserRegistInfo dest) { return Mapper.Map(model, dest); } public static UserRegistViewModel AsDriverRegistViewModel(this UserRegistInfo model) { return Mapper.Map(model); } } }