コード例 #1
0
        // GET: AutoParts/Create
        public ActionResult Create()
        {
            SelectListCommon selCommonObj = new SelectListCommon();

            ViewBag.ListOfPartCategories = selCommonObj.ListOfPartCategories();
            ViewBag.ListOfAutoYears      = selCommonObj.listOfAutoYears();
            ViewBag.ListOfCarMakes       = selCommonObj.listOfCarMakes();
            ViewBag.ListOfAutoBrands     = selCommonObj.listOfAutoBrands();
            ViewBag.ListOfCountryMadeIn  = selCommonObj.listOfCountryMadeIn();

            return(View());
        }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "Id,PartNo,PartCategory,Year,Make,Model,PartDescription,Brand,MadeIn,EngineType,PartSubCategory,PartImage")] AutoPart autoPart)
        {
            if (ModelState.IsValid)
            {
                db.Entry(autoPart).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("CreatePartII", new { id = autoPart.Id }));
            }

            SelectListCommon selCommonObj = new SelectListCommon();

            ViewBag.ListOfPartCategories = selCommonObj.ListOfPartCategories();
            ViewBag.ListOfAutoYears      = selCommonObj.listOfAutoYears();
            ViewBag.ListOfCarMakes       = selCommonObj.listOfCarMakes();
            ViewBag.ListOfAutoBrands     = selCommonObj.listOfAutoBrands();
            ViewBag.ListOfCountryMadeIn  = selCommonObj.listOfCountryMadeIn();

            return(View(autoPart));
        } //--
コード例 #3
0
        // GET: AutoParts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AutoPart autoPart = db.AutoParts.Find(id);

            if (autoPart == null)
            {
                return(HttpNotFound());
            }

            SelectListCommon selCommonObj = new SelectListCommon();

            ViewBag.ListOfPartCategories = selCommonObj.ListOfPartCategories();
            ViewBag.ListOfAutoYears      = selCommonObj.listOfAutoYears();
            ViewBag.ListOfCarMakes       = selCommonObj.listOfCarMakes();
            ViewBag.ListOfAutoBrands     = selCommonObj.listOfAutoBrands();
            ViewBag.ListOfCountryMadeIn  = selCommonObj.listOfCountryMadeIn();

            return(View(autoPart));
        }