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); }
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); }