public ActionResult Create(BlogPostViewModel vmdl) { if (ModelState.IsValid) { IBlogPost blogPost = new BlogPost(); blogPost.CreatedBy = _bl.GetUser((string)Session["email"]);; blogPost.CreatedOn = DateTime.Now; vmdl.ApplyChanges(blogPost); _bl.AddPost(blogPost); _bl.SaveChanges(); CacheController.UpdateBlogPosts(_bl); return(RedirectToAction("Index", "BlogPosts")); } return(View(vmdl)); }
public ActionResult Edit(int id) { return(View(new UserViewModel(_bl.GetUser(id)))); }