public ActionResult RegisterNewBuyer(BuyerRegistrationViewModel postModel) { if (ModelState.IsValid) { Mapper.CreateMap <BuyerRegistrationViewModel, Buyer>(); Mapper.CreateMap <BuyerRegistrationViewModel, User>(); Buyer buyer = Mapper.Map <BuyerRegistrationViewModel, Buyer>(postModel); User user = Mapper.Map <BuyerRegistrationViewModel, User>(postModel); UserComponent userComponent = new UserComponent(); ValidationResults vResult = userComponent.CreateUser(user); postModel.ValidationResult = vResult; if (vResult.Success == true) { BuyerComponent buyerComponent = new BuyerComponent(); vResult = buyerComponent.RegisterNewBuyer(buyer); postModel.ValidationResult = vResult; } } else { ListComponent lstComponent = new ListComponent(); postModel.Countries = lstComponent.GetListItemsById("Country"); postModel.Cities = lstComponent.GetListItemsById("City"); postModel.AreBothAddressSameOptions = lstComponent.GetListItemsById("YesOrNo"); } return(View("RegisterNewBuyer", postModel)); }