public ActionResult Create(Survey survey) { survey.UserId = WebSecurity.GetUserId(User.Identity.Name); //survey.CreationDate = DateTime.Now; if (ModelState.IsValid) { db.Surveys.Add(survey); db.SaveChanges(); return RedirectToAction("Index"); } return View(survey); }
public ActionResult Edit(Survey survey) { survey.UserId = WebSecurity.GetUserId(User.Identity.Name); if (ModelState.IsValid) { db.Entry(survey).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(survey); }