コード例 #1
0
ファイル: TopicService.cs プロジェクト: ThomPuiman/CEngine45
 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;
 }
コード例 #2
0
 public ActionResult New(Post firstPost)
 {
     _topicInstance.Create(firstPost);
     return View();
 }