public ActionResult Create(PosterModel postermodel) { if (ModelState.IsValid) { //Server.HtmlEncode(postermodel.Text); postermodel.PostTime = DateTime.Now; postermodel.ModifyTime = DateTime.Now; postermodel.UserId = new UsersContext().UserProfiles.Single(u => u.UserName == User.Identity.Name).UserId; db.Posters.Add(postermodel); db.SaveChanges(); //return RedirectToAction("Index"); return RedirectToAction("Details/"+postermodel.Id); } //return View(postermodel); return RedirectToAction("Details/" + postermodel.Id); }
public ActionResult Edit(PosterModel postermodel) { if (ModelState.IsValid) { db.Entry(postermodel).State = EntityState.Modified; postermodel.ModifyTime = DateTime.Now; db.SaveChanges(); return RedirectToAction("Index"); } return View(postermodel); }