Example #1
0
        public ActionResult Options(QuoteOptionsModel model)
        {
            using (var qm = new QuoteManager())
            {
                foreach (var psm in model.ProductLineSelectionModels)
                {
                    if (psm.IsSelected)
                    {
                        // add it to the quote options database
                        var option = new QuoteOption
                        {
                            QuoteID         = model.QuoteID,
                            ContentCategory = QuoteOptionCategory.ProductLineMapping,
                            ForeignKey      = psm.ProductLineID,
                            TableName       = TableName.ProductLine
                        };
                        option = qm.CreateOption(option);
                    }
                }

                foreach (var msm in model.ManufacturerSelectionModels)
                {
                    if (msm.IsSelected)
                    {
                        // add it to the quote options database
                        var option = new QuoteOption
                        {
                            QuoteID         = model.QuoteID,
                            ContentCategory = QuoteOptionCategory.ManufacturerDefault,
                            ForeignKey      = msm.ManufacturerID,
                            TableName       = TableName.Manufacturer
                        };
                        option = qm.CreateOption(option);
                    }
                }
            }
            return(RedirectToAction("Edit", new { id = model.QuoteID }));
        }
Example #2
0
        public ActionResult Options(int id)
        {
            List <Manufacturer> manufacturers;
            List <ProductLine>  productLines;

            var model = new QuoteOptionsModel {
                QuoteID = id
            };

            using (var mm = new ManufacturerManager())
            {
                manufacturers = mm.All().ToList();
            }

            using (var mm = new MaterialsManager())
            {
                productLines = mm.ActiveProductLines().ToList();
            }

            model.ManufacturerSelectionModels = manufacturers.Select(manufacturer => new ManufacturerSelectionModel
            {
                IsSelected       = false,
                ManufacturerID   = manufacturer.ID,
                ManufacturerName = manufacturer.Name
            }).ToList();

            model.ProductLineSelectionModels = productLines.Select(productLine => new ProductLineSelectionModel
            {
                IsSelected      = false,
                ProductLineID   = productLine.ID,
                ProductLineName = productLine.Name
            }).ToList();


            return(View("Options", model));
        }