public Topic Create(Post firstPost) { firstPost.CreatedBy = userServiceInstance.CurrentUser(); firstPost.Topic.CreatedBy = userServiceInstance.CurrentUser(); using (CommunityDbContext db = new CommunityDbContext()) { db.Posts.Add(firstPost); db.Topics.Add(firstPost.Topic); db.SaveChanges(); } return firstPost.Topic; }
public ActionResult New(Post firstPost) { _topicInstance.Create(firstPost); return View(); }