コード例 #1
0
        public static WarriorUser ToWarriorUser(this RegistrationViewModel model)
        {
            var warriorUser = new WarriorUser
            {
                Password     = model.LoginInfo.Password,
                UserName     = model.LoginInfo.UserName,
                PersonalInfo = new PersonalInfo
                {
                    FirstName    = model.PersonalInfo.FirstName,
                    LastName     = model.PersonalInfo.LastName,
                    EmailAddress = model.PersonalInfo.EmailAddress,
                    PhoneNumber  = model.PersonalInfo.PhoneNumber
                },
                CompanyInfo = new CompanyInfo
                {
                    CompanyName  = model.CompanyInfo.CompanyName,
                    EmailAddress = model.CompanyInfo.EmailAddress,
                    PhoneNumber  = model.CompanyInfo.PhoneNumber,
                    Address      = new Address
                    {
                        AddressLine1 = model.CompanyInfo.AddressLine1,
                        AddressLine2 = model.CompanyInfo.AddressLine2,
                        City         = model.CompanyInfo.City,
                        State        = model.CompanyInfo.State,
                        ZipCode      = model.CompanyInfo.ZipCode
                    },
                    Trucks = new Trucks
                    {
                        NumberOfTrucks         = model.TrucksInfo.NumberOfTrucks,
                        TrucksLineOfBusinesses = model.TrucksInfo.LineOfBusinesses.ToList()
                                                 .Select(x => new TrucksLineOfBusiness {
                            LineOfBusiness_Id = Int32.Parse(x)
                        }).ToList()
                    }
                }
            };

            return(warriorUser);
        }
コード例 #2
0
 public WarriorUser CreateUser(WarriorUser warriorUser)
 {
     return(_userRepository.CreateUser(warriorUser));
 }
コード例 #3
0
 public WarriorUser CreateUser(WarriorUser warriorUser)
 {
     _context.WarriorUsers.Add(warriorUser);
     _context.SaveChanges();
     return(warriorUser);
 }