Exemple #1
0
        public void Handle(AddNewCommentCommand command)
        {
            //Lesson lesson = repo.GetById<Lesson>(command.Id, command.Version);
            Lesson lesson = repo.GetById <Lesson>(command.Id);

            lesson.AddNewComment(command.CommentId, command.AuthorId, command.Content, command.Date, command.ParentId, command.Level);
            repo.Save(lesson, Guid.NewGuid());
        }
Exemple #2
0
        public void AddNewComment(CommentViewModel model)
        {
            Guid     lessonId = database.IdMaps.GetAggregateId <Lesson>(model.LessonId);
            Guid     authorId = database.IdMaps.GetAggregateId <User>(model.Author.UserId);
            Guid     parentId = model.ParentId == null ? Guid.Empty : database.IdMaps.GetAggregateId <LessonComment>(model.ParentId.Value);
            DateTime date     = model.Date == null ? DateTime.Now : model.Date.Value;

            var command = new AddNewCommentCommand(lessonId, authorId, model.Content, date, parentId, model.Level, model.Vers);

            bus.Send <AddNewCommentCommand>(command);
            model.Id = database.IdMaps.GetModelId <LessonComment>(command.CommentId);
        }