// GET: SubCategories/Create
 public ActionResult Create()
 {
     ViewBag.BusinessEntityID = new SelectList(
         CombosHelper.GetBusinessEntities(), //trae del helper la lista ordenada del combo
         "BusinessEntityID",                 //lo que llama
         "BusinessEntityName");              // lo que muestra
     return(View());
 }
Beispiel #2
0
 public ActionResult Edit(Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BusinessEntityID = new SelectList(CombosHelper.GetBusinessEntities(), "BusinessEntityID", "BusinessEntityName", question.BusinessEntityID);
     ViewBag.SubCategoryID    = new SelectList(CombosHelper.GetSubCategories(question.BusinessEntityID), "SubCategoryID", "SubCategoryName", question.SubCategoryID);
     return(View(question));
 }
Beispiel #3
0
        // GET: Questions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Question question = db.Questions.Find(id);

            if (question == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BusinessEntityID = new SelectList(CombosHelper.GetBusinessEntities(), "BusinessEntityID", "BusinessEntityName", question.BusinessEntityID);
            ViewBag.SubCategoryID    = new SelectList(CombosHelper.GetSubCategories(question.BusinessEntityID), "SubCategoryID", "SubCategoryName", question.SubCategoryID);
            return(View(question));
        }
        // GET: SubCategories/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCategory subCategory = db.SubCategories.Find(id);

            if (subCategory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BusinessEntityID = new SelectList(
                CombosHelper.GetBusinessEntities(), //trae del helper la lista ordenada del combo,
                "BusinessEntityID",
                "BusinessEntityName",
                subCategory.BusinessEntityID);
            return(View(subCategory));
        }
        public ActionResult Edit(SubCategory subCategory)
        {
            if (ModelState.IsValid)
            {
                db.Entry(subCategory).State = EntityState.Modified;
                var response = DBHelper.SaveChanges(db);
                if (response.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }

                ModelState.AddModelError(string.Empty, response.Message);
            }
            ViewBag.BusinessEntityID = new SelectList(
                CombosHelper.GetBusinessEntities(), //trae del helper la lista ordenada del combo,
                "BusinessEntityID",
                "BusinessEntityName",
                subCategory.BusinessEntityID);
            return(View(subCategory));
        }
Beispiel #6
0
 // GET: Questions/Create
 public ActionResult Create()
 {
     ViewBag.BusinessEntityID = new SelectList(CombosHelper.GetBusinessEntities(), "BusinessEntityID", "BusinessEntityName");
     ViewBag.SubCategoryID    = new SelectList(CombosHelper.GetSubCategories(0), "SubCategoryID", "SubCategoryName");
     return(View());
 }