Exemplo n.º 1
0
        public ActionResult Create(CategoryQuery categoryquery)
        {
            if (ModelState.IsValid)
            {
                db.CategoryQueries.Add(categoryquery);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.UserId = new SelectList(db.Users, "UserId", "UserName", categoryquery.UserId);
            return View(categoryquery);
        }
Exemplo n.º 2
0
 public ActionResult Edit(CategoryQuery categoryquery)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categoryquery).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.UserId = new SelectList(db.Users, "UserId", "UserName", categoryquery.UserId);
     return View(categoryquery);
 }