public ActionResult Create(ReplyModel replymodel) { if (ModelState.IsValid) { db.Replys.Add(replymodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(replymodel); }
public ActionResult addComment(int id = 0) { var replyContext = new ReplyDBContext(); ReplyModel rModel = new ReplyModel(); rModel.PoserId = id; rModel.Text = Request.Unvalidated["replyText"]; rModel.UserId = new UsersContext().UserProfiles.Single(u=>u.UserName == User.Identity.Name).UserId; rModel.CreateTime = DateTime.Now; rModel.ModifyTime = DateTime.Now; replyContext.Replys.Add(rModel); replyContext.SaveChanges(); return RedirectToAction("details/" + id); }
public ActionResult Edit(ReplyModel replymodel) { if (ModelState.IsValid) { db.Entry(replymodel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(replymodel); }