public Resultat<Topic> CreateTopic(CreateTopicCommand command) { return Resultat<Topic>.SafeExecute<ForumService>( result => { var topic = new Topic { CategorieId = command.CategorieId, Contenu = command.Contenu, CreateurId = command.CreateurId, DateCreation = command.DateCreation, Nom = command.Nom }; context.Topics.AddObject(topic); context.SaveChanges(); }); }
private void FixupTopic(Topic previousValue) { if (previousValue != null && previousValue.Messages.Contains(this)) { previousValue.Messages.Remove(this); } if (Topic != null) { if (!Topic.Messages.Contains(this)) { Topic.Messages.Add(this); } if (TopicId != Topic.Id) { TopicId = Topic.Id; } } }