public void Handle(UpdateQuestion @event) { var entity = _questionReader.GetById(@event.QuestionId); @event.ApplyPropertyUpdates(entity); _questionSaver.Save(entity); _hub.Publish(new Commit()); }
public void Handle(UpdateOption @event) { var option = _optionReader.GetById(@event.OptionId); @event.ApplyPropertyUpdates(option); _optionSaver.Save(option); _hub.Publish(new Commit()); }
public void Handle(UpdateAnswer @event) { var option = _hub.Send(new GetOptionById(@event.OptionId)); if (option.QuestionId != @event.QuestionId) { @event.QuestionId = option.QuestionId; @event.DirtyProperties.Add(typeof(IUpdateAnswer).GetProperty(nameof(IUpdateAnswer.QuestionId))); } var entity = _answerReader.GetById(@event.AnswerId); @event.ApplyPropertyUpdates(entity); _answerSaver.Save(entity); _hub.Publish(new Commit()); }
public OptionModel Handle(GetOptionById request) { var option = _optionReader.GetById(request.OptionId); return(_mapper.Map <OptionModel>(option)); }
public Questionnaire Handle(GetQuestionnaireById request) { // TODO: not sure if null object pattern is appropriate here...? return(_questionnaireReader.GetById(request.QuestionnaireId) ?? new Questionnaire { }); }