public static CorrectionModel Map(this CorrectionView source) => new CorrectionModel { Id = source.Id, Language = source.Language, Profile = source.Profile, IncorrectText = source.IncorrectText, CorrectText = source.CorrectText };
public async Task <IActionResult> AddCorrection(string language, string profile, [FromBody] CorrectionView correction, CancellationToken cancellationToken = default(CancellationToken)) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(ModelState)); } correction.Language = language; correction.Profile = profile; var request = new AddCorrectionRequest(correction.Map()); await _commandProcessor.SendAsync(request, cancellationToken : cancellationToken); var renderResult = _correctionRenderer.Render(request.Result); return(new CreatedResult(renderResult.Links.Self(), renderResult)); }