Esempio n. 1
0
        public void Handle(AddNewRatingCommand command)
        {
            //Lesson lesson = repo.GetById<Lesson>(command.Id, command.Version);
            Lesson lesson = repo.GetById <Lesson>(command.Id);

            lesson.AddNewRating(command.RatingId, command.Rating, command.UserId, command.Content, command.Date);
            repo.Save(lesson, Guid.NewGuid());
        }
Esempio n. 2
0
        public void AddNewRating(RatingViewModel model)
        {
            Guid     lessonId = database.IdMaps.GetAggregateId <Lesson>(model.LessonId);
            Guid     authorId = database.IdMaps.GetAggregateId <User>(model.Author.UserId);
            DateTime date     = model.Date == null ? DateTime.Now : model.Date.Value;

            var command = new AddNewRatingCommand(lessonId, authorId, model.Rating, model.Content, date, model.Vers);

            bus.Send <AddNewRatingCommand>(command);
            model.Id = database.IdMaps.GetModelId <LessonRating>(command.RatingId);
        }