public ContactDetailsViewModel(CoreDTO.DTOContactDetails DTOContact) { FirstName = DTOContact.FirstName; LastName = DTOContact.LastName; Email = DTOContact.Email; Address1 = DTOContact.Address1; Address2 = DTOContact.Address2; CountryList = DTOContact.CountryList.Select(i => new SelectListItem() { Text = i.Name, Value = i.Value }); StateList = DTOContact.StateList.Select(i => new SelectListItem() { Text = i.Name, Value = i.Value }); }
public ActionResult Payments(PaymentsViewModel model) { var movel = ModelState; //if (ModelState.IsValid) //{ ModelState.AddModelError("", "Error occured in model"); ViewModel.Intake.IntakeViewModel intakemodel = new ViewModel.Intake.IntakeViewModel(); intakemodel.PaymentsViewModel = new ViewModel.Payments.PaymentsViewModel(); intakemodel.PharmacyViewModel = new ViewModel.Pharmacy.PharmacyViewModel(); intakemodel.PharmacyViewModel.Pharmacies = new List <Models.PharmacyDetails>(); PharmacyDetails pd = new PharmacyDetails(); pd.PharmacyAddress = "Karachi"; pd.PharmacyID = "1"; pd.PharmacyName = "CVS pharmacy"; intakemodel.PharmacyViewModel.Pharmacies.Add(pd); CoreDTO.DTOContactDetails DTOCD = new CoreDTO.DTOContactDetails(); DTOCD.Address1 = "ABC"; DTOCD.Address2 = "BCD"; DTOCD.Email = "ASDDADS"; DTOCD.CountryList = new List <CoreDTO.Country> { new CoreDTO.Country { Name = "USA", Value = "US" }, new CoreDTO.Country { Name = "Canada", Value = "US" } }; DTOCD.StateList = new List <CoreDTO.State> { new CoreDTO.State { Name = "NewYork", Value = "US" }, new CoreDTO.State { Name = "Chicago", Value = "US" } }; ContactDetailsViewModel CDVM = new ContactDetailsViewModel(DTOCD); intakemodel.ContactDetailsViewModel = CDVM; return(View("Index", intakemodel)); //} }
// GET: Intake public ActionResult Index() { ViewModel.Intake.IntakeViewModel intakemodel = new ViewModel.Intake.IntakeViewModel(); intakemodel.PaymentsViewModel = new ViewModel.Payments.PaymentsViewModel(); intakemodel.PharmacyViewModel = new ViewModel.Pharmacy.PharmacyViewModel(); intakemodel.PharmacyViewModel.Pharmacies = new List <Models.PharmacyDetails>(); PharmacyDetails pd = new PharmacyDetails(); pd.PharmacyAddress = "Karachi"; pd.PharmacyID = "1"; pd.PharmacyName = "CVS pharmacy"; intakemodel.PharmacyViewModel.Pharmacies.Add(pd); CoreDTO.DTOContactDetails DTOCD = new CoreDTO.DTOContactDetails(); DTOCD.Address1 = "ABC"; DTOCD.Address2 = "BCD"; DTOCD.Email = "ASDDADS"; DTOCD.CountryList = new List <CoreDTO.Country> { new CoreDTO.Country { Name = "USA", Value = "US" }, new CoreDTO.Country { Name = "Canada", Value = "US" } }; DTOCD.StateList = new List <CoreDTO.State> { new CoreDTO.State { Name = "NewYork", Value = "US" }, new CoreDTO.State { Name = "Chicago", Value = "US" } }; ContactDetailsViewModel CDVM = new ContactDetailsViewModel(DTOCD); intakemodel.ContactDetailsViewModel = CDVM; return(View(intakemodel)); }