public Driver Save(long quoteId)
        {
            Driver d = new Driver();
            d.Id = DriverViewModel.ID;
            d.Address = DriverViewModel.Address;
            d.Dob = DriverViewModel.Dob.DateTime;
            d.FirstName = DriverViewModel.FirstName;
            d.Gender = Enum.GetName(typeof(Gender), DriverViewModel.Gender);
            d.LastName = DriverViewModel.LastName;
            d.LicenseDateStart = DriverViewModel.LicenseDateStart.DateTime;
            d.LicenseNumber = DriverViewModel.LicenseNumber;
            d.LicenseState = Enum.GetName(typeof(State), DriverViewModel.LicenseState);
            d.MiddleInitial = DriverViewModel.MiddleInitial;
            d.NameSuffix = DriverViewModel.NameSuffix;
            d.Phone = DriverViewModel.Phone;
            d.Relationship = DriverViewModel.Relationship;
            d.SafeDrivingSchool = DriverViewModel.SafeDrivingSchool;
            d.Ssn = DriverViewModel.Ssn;
            d.QuoteId = quoteId;

            return Helper.Put(d, d.Id);
        }
Beispiel #2
0
 public static DriverViewModel convertDriverToDriverViewModel(Driver driver)
 {
     DriverViewModel dvm = new DriverViewModel();
     dvm.Address = driver.Address;
     dvm.Dob = driver.Dob;
     dvm.FirstName = driver.FirstName;
     dvm.Gender = (Gender)Enum.Parse(typeof(Gender), driver.Gender);
     dvm.ID = driver.Id;
     dvm.LastName = driver.LastName;
     dvm.LicenseDateStart = driver.LicenseDateStart;
     dvm.LicenseNumber = driver.LicenseNumber;
     dvm.LicenseState = (State)Enum.Parse(typeof(State), driver.LicenseState);
     dvm.MiddleInitial = driver.MiddleInitial;
     dvm.NameSuffix = driver.NameSuffix;
     dvm.NonDriver = driver.NonDriver;
     dvm.Phone = driver.Phone;
     dvm.QuoteID = driver.QuoteId;
     dvm.Relationship = driver.Relationship;
     dvm.SafeDrivingSchool = driver.SafeDrivingSchool;
     dvm.Ssn = driver.Ssn;
     return dvm;
 }
Beispiel #3
0
        public static Driver convertDriverViewModelToDriver(DriverViewModel dvm)
        {
            Driver d = new Driver();
            d.Address = dvm.Address;
            d.Dob = dvm.Dob.DateTime;
            d.FirstName = dvm.FirstName;
            d.Gender = (String)Enum.Parse(typeof(String), d.Gender);
            d.Id = dvm.ID;
            d.LastName = dvm.LastName;
            d.LicenseDateStart = dvm.LicenseDateStart.DateTime;
            d.LicenseNumber = dvm.LicenseNumber;
            d.LicenseState = Enum.GetName(typeof(State), dvm.LicenseState);
            d.MiddleInitial = dvm.MiddleInitial;
            d.NameSuffix = dvm.NameSuffix;
            d.NonDriver = dvm.NonDriver;
            d.Phone = dvm.Phone;
            d.QuoteId = dvm.QuoteID;
            d.Relationship = dvm.Relationship;
            d.SafeDrivingSchool = dvm.SafeDrivingSchool;
            d.Ssn = dvm.Ssn;

            return d;
        }