private void GivenTheCatalogHasBeenCreated(Catalog catalog)
        {
            GivenIdentitySeedsAreReset();
            var repository = new CatalogRepository();

            repository.Create(catalog);
        }
        public void AddDuplicateProducts()
        {
            var testObject = new Product()
            {
                Name = "nametestproduct", Description = "this is a test", Quantity = 1
            };

            var repository = new CatalogRepository();

            repository.Create(testObject);

            //Assert
            var product = repository.GetByName(testObject.Name);

            Assert.IsNotNull(product);

            repository.Create(testObject);
        }
Exemple #3
0
        protected void WhenCatalogsAreCreated(params Catalog[] entities)
        {
            var repository = new CatalogRepository();

            foreach (var entity in entities)
            {
                repository.Create(entity);
            }
        }
        public void AddProductWithoutQuantity()
        {
            var testObject = new Product()
            {
                Name = "nametestproduct", Description = "this is a test"
            };

            var repository = new CatalogRepository();

            repository.Create(testObject);
        }
Exemple #5
0
        public static int GetPackageId(string value)
        {
            if (_Packages.IsNullOrEmpty())
            {
                _Packages = CatalogRepository.GetAll <PackageInfo>();
            }
            var entity = _Packages.FirstOrDefault(c => c.Name.Equals(value, StringComparison.CurrentCultureIgnoreCase));

            if (entity == null)
            {
                entity = new PackageInfo {
                    Name = value
                };
                entity.Id = CatalogRepository.Create(entity);
                _Packages.Add(entity);
            }
            return(entity.Id);
        }
Exemple #6
0
        public string Edit(FormDataCollection form)
        {
            var retVal    = string.Empty;
            var operation = form.Get("oper");
            var id        = form.Get("Id").Split(',')[0].ToInt32();

            if (string.IsNullOrEmpty(operation))
            {
                return(retVal);
            }

            TimeSlotInfo info;

            switch (operation)
            {
            case "edit":
                info = CatalogRepository.GetInfo <TimeSlotInfo>(id);
                if (info != null)
                {
                    info.Name      = form.Get("Name");
                    info.OrderTime = form.Get("OrderTime").ToInt32();
                    CatalogRepository.Update(info);
                }
                break;

            case "add":
                info = new TimeSlotInfo
                {
                    Name      = form.Get("Name"),
                    OrderTime = form.Get("OrderTime").ToInt32()
                };
                CatalogRepository.Create(info);
                break;

            case "del":
                CatalogRepository.Delete <TimeSlotInfo>(id);
                break;
            }
            StoreData.ReloadData <TimeSlotInfo>();
            return(retVal);
        }
        private void CreateCatalog(Catalog catalog)
        {
            var catalogRepository = new CatalogRepository();

            catalogRepository.Create(catalog);
        }