public ActionResult Details(int id) { Postdb postdb = repository.Get(id); var post = Mapper.Map <Postdb, Post>(postdb); Session["PostId"] = post.Id; return(View(post)); }
public ActionResult CreatePost() { Postdb post = new Postdb() { Id = 1, StudentId = 1, Content = "New Content", Created = DateTime.Now }; return(View(post)); }
public ActionResult Delete(int?id) { if (id == null) { return(HttpNotFound()); } Postdb post = repository.Get(id.Value); return(View(post)); }
public ActionResult Edit(Postdb model) { if (ModelState.IsValid) { repository.Update(model); repository.Save(); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult CreatePost(Postdb model) { if (ModelState.IsValid) { model.Created = DateTime.Now; repository.Create(model); repository.Save(); return(RedirectToAction("Index")); } return(View(model)); }