public async Task <IActionResult> CreateReply([FromBody] CreateReplyCmd createReplyCmd) { var expr = from createReplyResult in QuestionDomain.CreateReply(createReplyCmd.QuestionId, createReplyCmd.Body) let reply = createReplyResult.SafeCast <ReplyCreated>().Select(r => r) from checkLanguageResult in QuestionDomain.CheckLanguage(createReplyCmd.Body) from questionOwnerAckResult in QuestionDomain.AckQuestionOwner(createReplyCmd.QuestionId, "Some message") //de aici se poate extrage questionOwnerId from replyAuthorAckResult in QuestionDomain.AckReplyAuthor(createReplyCmd.replyId, "some notify message") //de aici se poate extrage replyAuthodId select new { createReplyResult, questionOwnerAckResult, replyAuthorAckResult }; //evenimentele returnate de workflow var ctx = new QuestionReadContext(new List <Post>()); var r = await _interpreter.Interpret(expr, ctx); await _dbContext.SaveChangesAsync(); return(r.createReplyResult.Match( Created => (IActionResult)OK(new Object()), NotCreated => BadRequest(new Object()) )); }