public ActionResult DocCreate(Documents documents) { if (ModelState.IsValid) { db.Documents.Add(documents); db.SaveChanges(); Session["currDocKey"] = documents.pKey; return RedirectToAction("DocEdit/" + Session["currDocKey"].ToString()); } return View(documents); }
// GET: Documents/Create public ActionResult DocCreate() { var GroupList = db.Groups.Where(x => x.DistKey == GlobalVariables.DistKey).Select(x => new SelectListItem { Value = x.pKey.ToString(), Text = x.GroupName, }); ViewData["GroupID"] = GroupList; Documents doc = new Documents(); doc.DistKey = GlobalVariables.DistKey; doc.DocDate = DateTime.Now; return View(doc); }
public ActionResult DocEdit(Documents documents) { if (Session["currFile"] != null) { documents.DocLink = Session["currFile"].ToString(); } documents.DistKey = GlobalVariables.DistKey; if (ModelState.IsValid) { db.Entry(documents).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("DocIndex"); } return View(documents); }