public ActionResult Edit(ProjectTag projecttag) { if (ModelState.IsValid) { db.Entry(projecttag).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProjectID = new SelectList(db.Projects, "ProjectID", "alias", projecttag.ProjectID); ViewBag.TagID = new SelectList(db.Tags, "TagID", "name", projecttag.TagID); return View(projecttag); }
public ActionResult Create(ProjectTag projecttag) { if (ModelState.IsValid) { db.ProjectTags.Add(projecttag); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProjectID = new SelectList(db.Projects, "ProjectID", "alias", projecttag.ProjectID); ViewBag.TagID = new SelectList(db.Tags, "TagID", "name", projecttag.TagID); return View(projecttag); }