public async Task <IActionResult> CreateQuestion([FromBody] QuestionCmd cmd) { var dep = new QuestionDependencies(); //var question = await _dbContext.QuestionDB.ToListAsync(); var ctx = new WriteContext(); var expr = from CreateTenantResult in QuestionContext.CreateQuestion(cmd) select CreateTenantResult; var r = await _interpreter.Interpret(expr, ctx, dep); await _dbContext.SaveChangesAsync(); return(r.Match( succ => (IActionResult)Ok(succ), fail => BadRequest("Error") )); }
public static Port <IQuestionResult> CreateQuestion(QuestionCmd questionCmd) => NewPort <QuestionCmd, IQuestionResult>(questionCmd);