Ejemplo n.º 1
0
 private static bool IsNewAddress(AddressModel address)
 {
     return !string.IsNullOrEmpty(address.City) ||
            !string.IsNullOrEmpty(address.Line1) ||
            !string.IsNullOrEmpty(address.Line2) ||
            !string.IsNullOrEmpty(address.State) ||
            !string.IsNullOrEmpty(address.PostCode) ||
            !string.IsNullOrEmpty(address.Country);
 }
Ejemplo n.º 2
0
        public static MerchantOrderlineModel Create(OrderlineModel orderline, AddressModel deliveryAddress, DateTime dateCreated, string emailAddress)
        {
            var model = new MerchantOrderlineModel();
            model.Orderline = orderline;
            model.DeliveryAddress = deliveryAddress;
            model.DateCreated = dateCreated;
            model.EmailAddress = emailAddress;

            return model;
        }
Ejemplo n.º 3
0
        public static UserModel CreateUser(string key = "", string emailAddress = "", AddressModel contactAddress = null, AddressModel billingAddress = null, string username = "")
        {
            if (string.IsNullOrWhiteSpace(emailAddress))
            {
                emailAddress = string.Format("{0}@{1}.com", fixture.Create<string>(), fixture.Create<string>());
            }

            if (string.IsNullOrEmpty(username))
            {
                username = emailAddress;
            }

            var user = UserModel.Create(emailAddress, username);

            user.SetContactAddress(contactAddress ?? CreateAddress());
            user.SetBillingAddress(billingAddress ?? CreateAddress());

            user.Key = string.IsNullOrEmpty(key) ? fixture.Create<string>() : key;

            return user;
        }
Ejemplo n.º 4
0
        private static IList<ApplicationUser> CreateUsers(DealsWhatDbContext context)
        {
            var users = new List<ApplicationUser>();

            for (int i = 0; i < 10; i++)
            {
                //var user = new ApplicationUser();
                //user.UserName = string.Format("User{0}", i);
                //user.Email = string.Format("user{0}@email.com", i);
                //user.Id = i.ToString();
                //user.EmailConfirmed = true;

                //var userName = string.Format("User{0}", i);
                //var user = UserModel.Create(userName, userName);
                //user.SetFirstName("first");
                //user.SetLastName("last");

                var user = new ApplicationUser
                {
                    Email = string.Format("User{0}", i),
                    UserName = string.Format("User{0}", i)
                };

                var address = new AddressModel();
                address.City = "Petaling Jaya";
                address.Country = "Malaysia";
                address.Line1 = "A021 Taman Sentosa";
                address.Line2 = "Jalan A11/2 Klang Lama";
                address.PostCode = "24141";
                address.State = "Selangor";
                user.SetBillingAddress(address);
                // var applicationUser = new ApplicationUser(user);

                //var user = new ApplicationUser
                //{
                //    UserId = i,
                //    Username = string.Format("User{0}", i),
                //    EmailAddress = string.Format("user{0}@email.com", i),
                //    AddressLine1 = "addressline1",
                //    State = "state",
                //    City = "city",
                //    Street = "street",
                //    FirstName = "firstname",
                //    LastName = "lastname",
                //    ZipCode = "zip"
                //};

                users.Add(user);
                context.Users.Add(user);
            }

            return users;
        }
Ejemplo n.º 5
0
 public void SetContactAddress(AddressModel addressModel)
 {
     ContactAddress = addressModel;
 }
Ejemplo n.º 6
0
 public void SetBillingAddress(AddressModel addressModel)
 {
     BillingAddress = addressModel;
 }