// // GET: /Posts/New public ActionResult New() { PostViewModel viewModel = new PostViewModel { ExistingTags = _tagsRepository.GetAll() }; return View(viewModel); }
public ActionResult New(PostViewModel view) { if (ModelState.IsValid) { Post post = new Post { Title = view.Title, Message = view.Message, PostedBy = User.ID }; _postsRepository.Create(post); return RedirectToAction("Index"); } return View(view); }