public ActionResult Edit(Post post) { try { // TODO: Add update logic here return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Post p) { try { p.Author = (SiteUser)Session["CurrentUser"]; p.Author.TryMakePost(p.Description, p.Text); Posts.Add(p); return RedirectToAction("Index"); } catch { return new HttpStatusCodeResult(401); } }
public Post TryMakePost(string description, string text) { var newPost = new Post { Author = this, DateTimeSubmitted = DateTime.Now, Description = description, Text = text, Id = Guid.NewGuid() }; return newPost; }