Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "ProductId,CategoryId,ProductName,SellIn,InitialQuality,ReceiptDate,LastUpdated")] Product product)
        {
            if (ModelState.IsValid)
            {
                product.ProductId = Guid.NewGuid();
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
            return(View(product));
        }
        public ActionResult Create([Bind(Include = "CategoryId,AgingSchemeId,CategoryName,LastUpdated")] Category category)
        {
            if (ModelState.IsValid)
            {
                category.CategoryId = Guid.NewGuid();
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AgingSchemeId = new SelectList(db.AgingSchemes, "AgingSchemeId", "SchemeName", category.AgingSchemeId);
            return(View(category));
        }
        public ActionResult Create([Bind(Include = "AgingThresholdId,AgingSchemeId,ThresholdName,DaysPrior,IncrementRate,LastUpdated")] AgingThreshold agingThreshold)
        {
            if (ModelState.IsValid)
            {
                agingThreshold.AgingThresholdId = Guid.NewGuid();
                db.AgingThresholds.Add(agingThreshold);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AgingSchemeId = new SelectList(db.AgingSchemes, "AgingSchemeId", "SchemeName", agingThreshold.AgingSchemeId);
            return(View(agingThreshold));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "AgingSchemeId,SchemeName,DefaultIncrement,MaxQuality,ScrapOnExpiration,ProductId,LastUpdated")] AgingScheme agingScheme)
        {
            if (ModelState.IsValid)
            {
                agingScheme.AgingSchemeId = Guid.NewGuid();
                db.AgingSchemes.Add(agingScheme);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", agingScheme.ProductId);
            return(View(agingScheme));
        }