public async Task <TextFile> AddFile(string text) { var textFile = new Text.Service.Repositories.Text { TextValue = text }; textFile = await _textRepository.Create(textFile); textFile.TextValue = null; return(_mapper.Map <TextFile>(textFile)); }
public async Task <ActionResult <TextResource> > Create(string org, string app, [FromBody] TextResource textResource) { try { if (!LanguageHelper.IsTwoLetters(textResource.Language)) { return(BadRequest("The language must be a two letter ISO language name.")); } var existingTextResource = await _textRepository.Get(org, app, textResource.Language); if (existingTextResource != null) { return(Conflict("Text resource allready exists.")); } var createdObjected = await _textRepository.Create(org, app, textResource); return(Ok(createdObjected)); } catch (Exception e) { _logger.LogError($"Unable to create text resource for {org}/{app}: {e.Message}"); return(StatusCode(500, $"Unable to create text resource for {org}/{app}")); } }
public async Task <TextFile> AddFile(string text) { var source = new Text() { TextValue = text }; await TextRepository.Create(source); return(Mapper.Map <TextFile>(source)); }
public void NewTextFile(string path, string content) { TryFlow(() => { var textFile = new TxtFile(path, content); var createOK = _dataRepo.Create(textFile); if (createOK) { Invoke(() => _view.ShowMessageBox("Create Success")); } }); }
public async Task <ActionResult <TextResource> > Create(string org, string app, [FromBody] TextResource textResource) { if (!LanguageHelper.IsTwoLetters(textResource.Language)) { return(BadRequest("The language must be a two letter ISO language name.")); } var existingTextResource = await _textRepository.Get(org, app, textResource.Language); if (existingTextResource != null) { return(Conflict("Text resource allready exists.")); } var createdObjected = await _textRepository.Create(org, app, textResource); return(Ok(createdObjected)); }