Exemplo n.º 1
0
        public void SeedingTestData()
        {
            if (!_inMemoryContext.StoreItem.Any())
            {
                _inMemoryContext.StoreItem.AddRange(StoreItemData.GetStoreItems());
                _inMemoryContext.SaveChanges();
            }

            if (!_inMemoryContext.StoreItemCategory.Any())
            {
                _inMemoryContext.StoreItemCategory.AddRange(StoreItemCategoryData.GetStoreItemsCategories());
                _inMemoryContext.SaveChanges();
            }

            if (!_inMemoryContext.CustomerInfo.Any())
            {
                _inMemoryContext.CustomerInfo.AddRange(CustomerInfoData.GetCustomerInformation());
                _inMemoryContext.SaveChanges();
            }
        }
        public bool RegisterUser(SignUpForm signUpForm)
        {
            CustomerInfo customerInfo = new CustomerInfo()
            {
                CustomerName = signUpForm.UserName,
                Phone        = signUpForm.MobileNumber,
                City         = signUpForm.City,
                FirstName    = signUpForm.FirstName,
                LastName     = signUpForm.LastName,
                Password     = signUpForm.Password
            };

            context.Entry <CustomerInfo>(customerInfo).State = EntityState.Added;
            return(context.SaveChanges() > 0);
        }