public ActionResult Create(CreateProductViewModel model)
        {
            if (ModelState.IsValid)
            {
                var supplier = _productFacade.GetSuppliers().FirstOrDefault(s => s.Id == model.SupplierId);
                if (supplier == null)
                {
                    supplier = new Supplier { Id = Guid.NewGuid(), Name = model.SupplierName };
                }

                var product = _productFactory.Create((ProductType)model.ProductTypeId, Guid.NewGuid(), model.Name,
                    model.Provision, model.StartPrice, supplier);

                switch ((ProductType)model.ProductTypeId)
                {
                    case ProductType.Antique:
                        (product as AntiqueProduct).TimeEpoch = (TimeEpoch)model.TimeEpochId;
                        break;
                    case ProductType.Mass:
                    case ProductType.Modern:
                        var designer = _productFacade.GetDesigners().FirstOrDefault(d => d.Id == model.DesignerId);
                        if (designer == null)
                        {
                            designer = new Designer { Id = Guid.NewGuid(), Name = model.DesignerName };
                        }
                        (product as DesignerProduct).Designer = designer;
                        break;
                    default:
                        break;
                }
                _productFacade.Add(product);
            }
            return RedirectToAction("Index");
        }
        public ActionResult Create()
        {
            var model = new CreateProductViewModel();

            var productTypes = from ProductType t in Enum.GetValues(typeof(ProductType))
                               select new
                               {
                                   ID = (int)t,
                                   Name = t.ToString()
                               };
            model.ProductTypes = new SelectList(productTypes, "ID", "Name");
            model.ProductTypeId = -1;

            var timeEpochs = from TimeEpoch t in Enum.GetValues(typeof(TimeEpoch))
                             select new
                             {
                                 ID = (int)t,
                                 Name = t.ToString()
                             };
            model.TimeEpochs = new SelectList(timeEpochs, "ID", "Name");
            model.TimeEpochId = -1;

            model.Suppliers = new SelectList(_productFacade.GetSuppliers(), "Id", "Name");
            model.Designers = new SelectList(_productFacade.GetDesigners(), "Id", "Name");

            return View(model);
        }