public ActionResult Register(FormCollection formCollection)
        {
            var registerationData = new RegisterationData();

            registerationData.Address = new AddressData
                                            {
                                                Line1 = formCollection["line1"],
                                                Line2 = formCollection["line2"],
                                                City = formCollection["city"],
                                                State = formCollection["state"],
                                                PostCode = formCollection["postcode"],
                                                Country = formCollection["country"],
                                                Type = new AddressTypeData {Id = 1},
                                                IsPrimary = true
                                            };
            registerationData.Constituent = new ConstituentData
                                                {
                                                    BornOn = DateTime.Parse(formCollection["dob"]).Date,
                                                    BranchName = new BranchTypeData() {Id = Convert.ToInt16(formCollection["branch"])},
                                                    Gender = formCollection["gender"],
                                                    HouseName = formCollection["housename"],
                                                    MaritialStatus = Convert.ToInt16(formCollection["maritalstatus"]),
                                                    Name = new ConstituentNameData
                                                               {
                                                                   FirstName = formCollection["firstname"],
                                                                   MiddleName = formCollection["middlename"],
                                                                   LastName = formCollection["lastname"],
                                                                   PreferedName = formCollection["preferedname"],
                                                                   Salutation = new SalutationTypeData {Id = Convert.ToInt16(formCollection["salutation"])}
                                                               }
                                                };
            registerationData.Phone = new PhoneData
                                          {
                                              Number = formCollection["phonenumber"],
                                              Type = new PhoneTypeData {Id = Convert.ToInt16(formCollection["phonetype"])},
                                              IsPrimary = true
                                          };

            registerationData.Email = formCollection["email"];
            registerationData.Password = formCollection["password"];

            var registeredData = HttpHelper.Post(serviceBaseUri+"/Registration",registerationData);
            return RedirectToAction("Index", "Home");
        }
        public void ShouldCreateRegisterationConstituent()
        {
            var registerationData = new RegisterationData()
                                        {
                                            Constituent = constituentData,
                                            Phone = PhoneDataMother.Mobile(),
                                            Email = EmailDataMother.Official().Address,
                                            Password = "******",
                                            Address = AddressDataMother.London(),
                                        };

            var savedRegisterationConstituent = HttpHelper.Post(baseUri, registerationData);

            Assert.IsNotNull(savedRegisterationConstituent);
            Assert.That(savedRegisterationConstituent.Constituent.Id, Is.GreaterThan(0));
            Assert.That(savedRegisterationConstituent.Constituent.Name.Id, Is.GreaterThan(0));
            Assert.That(savedRegisterationConstituent.Phone.Id, Is.GreaterThan(0));
            Assert.That(savedRegisterationConstituent.Address.Id, Is.GreaterThan(0));
            Assert.That(savedRegisterationConstituent.Email, Is.Not.Null);
            Assert.That(savedRegisterationConstituent.Password, Is.Not.Null);
        }
Esempio n. 3
0
 public PersistedUser()
 {
     RegisterationData = new RegisterationData();
     StorageData       = new StorageData();
 }