private Task <Validation <Error, MapperSourceText> > MapperSourceTextMustNotExist( MapperSourceText mapperSourceText) => _mapperSourceTextRepository.AnyAsync(e => e.Id == mapperSourceText.Id) .Map(exist => !exist ? Fail <Error, MapperSourceText>( $"Mapper source text {mapperSourceText.Id} does not exist") : Success <Error, MapperSourceText>(mapperSourceText));
public async Task <IActionResult> Put([FromBody] MapperSourceText data) { return(await ValidateEditMapperSourceText(data) .MapT(async d => { await _mapperSourceTextRepository.UpdateAsync(d); return d; }) .ToActionResultAsync()); }
public BeanParser(string xmlConfiguration, ITransformer fileLoaderService, IBeanMapper beanMapper, Option <MapperSourceText> mapperSrcText) { _xmlConfiguration = xmlConfiguration; _fileLoaderService = fileLoaderService; _beanMapper = beanMapper; if (mapperSrcText.IsSome) { _mapperSrcText = mapperSrcText.ValueUnsafe(); } }
private Task <Validation <Error, MapperSourceText> > ValidateEditMapperSourceText( MapperSourceText mapperSourceText) => ShouldNotNull(mapperSourceText) .AsTask() .BindT(MapperSourceTextMustNotExist);