public async Task <ActionResult <LabelTranslation> > PostLabelTranslation(LabelTranslation labelTranslation) { _context.LabelTranslations.Add(labelTranslation); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLabelTranslation", new { id = labelTranslation.Id }, labelTranslation)); }
public void LabelTranslation() { var entity = new LabelTranslation(); var entityType = entity.GetType(); var properties = entityType.GetProperties(); entityType.BaseType.Name.ShouldBe(nameof(BaseEntity)); entityType.GetInterface(nameof(ISchemaDomain)).ShouldNotBeNull(); AssertLongProperty(properties, "OrganizationId", entity.OrganizationId); AssertGuidProperty(properties, "OrganizationUid", entity.OrganizationUid); AssertStringProperty(properties, "OrganizationName", entity.OrganizationName); AssertLongProperty(properties, "ProjectId", entity.ProjectId); AssertGuidProperty(properties, "ProjectUid", entity.ProjectUid); AssertStringProperty(properties, "ProjectName", entity.ProjectName); AssertLongProperty(properties, "LabelId", entity.LabelId); AssertGuidProperty(properties, "LabelUid", entity.LabelUid); AssertStringProperty(properties, "LabelName", entity.LabelName); AssertLongProperty(properties, "LanguageId", entity.LanguageId); AssertGuidProperty(properties, "LanguageUid", entity.LanguageUid); AssertStringProperty(properties, "LanguageName", entity.LanguageName); AssertStringProperty(properties, "Translation", entity.Translation); AssertStringProperty(properties, "Description", entity.Description); AssertBooleanProperty(properties, "IsActive", entity.IsActive); }
public async Task <bool> DoDeleteTranslationWork(long currentUserId, LabelTranslation labelTranslation) { await _transactionalExecutor.ExecuteAsync <bool>(async connection => { _organizationRepository.SetSqlExecutorForTransaction(connection); _userRepository.SetSqlExecutorForTransaction(connection); _projectRepository.SetSqlExecutorForTransaction(connection); _labelRepository.SetSqlExecutorForTransaction(connection); _labelTranslationRepository.SetSqlExecutorForTransaction(connection); await _labelTranslationRepository.Delete(currentUserId, labelTranslation.Id); var organization = await _organizationRepository.SelectById(labelTranslation.OrganizationId); organization.LabelTranslationCount--; await _organizationRepository.Update(currentUserId, organization); var project = await _projectRepository.SelectById(labelTranslation.ProjectId); project.LabelTranslationCount--; await _projectRepository.Update(currentUserId, project); var label = await _labelRepository.SelectById(labelTranslation.LabelId); label.LabelTranslationCount--; await _labelRepository.Update(currentUserId, label); var user = await _userRepository.SelectById(currentUserId); user.LabelTranslationCount--; await _userRepository.Update(currentUserId, user); return(true); }); return(true); }
public async Task <IActionResult> PutLabelTranslation(int?id, LabelTranslation labelTranslation) { if (id != labelTranslation.Id) { return(BadRequest()); } _context.Entry(labelTranslation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LabelTranslationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public LabelTranslation CreateEntity(string translation, Label label, Language language) { var entity = new LabelTranslation(); entity.Translation = translation; entity.IsActive = true; entity.OrganizationId = label.OrganizationId; entity.OrganizationUid = label.OrganizationUid; entity.OrganizationName = label.OrganizationName; entity.ProjectId = label.ProjectId; entity.ProjectUid = label.ProjectUid; entity.ProjectName = label.ProjectName; entity.LabelId = label.Id; entity.LabelUid = label.Uid; entity.LabelName = label.Key; entity.LanguageId = language.Id; entity.LanguageUid = language.Uid; entity.LanguageName = language.Name; return(entity); }
//public LabelTranslation CloneEntityFromEntity(long currentUserId, string translation, Label label, // long languageId, Guid languageUid, string languageName, string languageIsoCode2Char) //{ // var entity = new LabelTranslation(); // entity.CreatedBy = currentUserId; // entity.Translation = translation; // entity.IsActive = true; // entity.OrganizationId = label.OrganizationId; // entity.OrganizationUid = label.OrganizationUid; // entity.OrganizationName = label.OrganizationName; // entity.ProjectId = label.ProjectId; // entity.ProjectUid = label.ProjectUid; // entity.ProjectName = label.ProjectName; // entity.LabelId = label.Id; // entity.LabelUid = label.Uid; // entity.LabelName = label.Key; // entity.LanguageId = languageId; // entity.LanguageUid = languageUid; // entity.LanguageName = languageName; // return entity; //} public LabelTranslationDto CreateDtoFromEntity(LabelTranslation entity, Language language) { var dto = CreateDtoFromEntity(entity); dto.LanguageIconUrl = language.IconUrl; dto.LanguageIsoCode2 = language.IsoCode2Char; return(dto); }
public LabelTranslationDao EntityToDao(LabelTranslation entity) { LabelTranslationDao dao = new LabelTranslationDao { Id = entity.Id, RefLabelId = converter.EntityToDao(entity.RefLabelId), Language = entity.Language, TranslationValue = entity.TranslationValue }; return(dao); }
public LabelTranslation DaoToEntity(LabelTranslationDao dao) { LabelTranslation entity = new LabelTranslation { Id = dao.Id, RefLabelId = converter.DaoToEntity(dao.RefLabelId), Language = dao.Language, TranslationValue = dao.TranslationValue }; return(entity); }
public override void SetInputErrorMessages() { if (OrganizationUid.IsEmptyGuid()) { ErrorMessages.Add("organization_uid_not_valid"); } if (ProjectUid.IsEmptyGuid()) { ErrorMessages.Add("project_uid_not_valid"); } ProjectName = ProjectName.TrimOrDefault(); if (ProjectName.IsEmpty()) { ErrorMessages.Add("project_name_not_valid"); } if (LabelUid.IsEmptyGuid()) { ErrorMessages.Add("label_uid_not_valid"); } LabelKey = LabelKey.TrimOrDefault(); if (LabelKey.IsEmpty()) { ErrorMessages.Add("label_key_not_valid"); } if (LanguageUid.IsEmptyGuid()) { LanguageInput.ErrorMessage.Add("language_uid_not_valid"); InputErrorMessages.AddRange(LanguageInput.ErrorMessage); } LabelTranslation = LabelTranslation.TrimOrDefault(); if (LabelTranslation.IsEmpty()) { LabelTranslationInput.ErrorMessage.Add("label_translation_required_error_message"); InputErrorMessages.AddRange(LabelTranslationInput.ErrorMessage); } }
public override void SetInputErrorMessages() { if (Label.IsEmpty()) { LabelInput.ErrorMessage.Add("name_required_error_message"); ErrorMessages.AddRange(LabelInput.ErrorMessage); } if (Language.IsEmpty()) { LanguageInput.ErrorMessage.Add("language_required_error_message"); ErrorMessages.AddRange(LanguageInput.ErrorMessage); } if (LabelTranslation.IsEmpty()) { LabelTranslationInput.ErrorMessage.Add("label_translation_required_error_message"); ErrorMessages.AddRange(LabelTranslationInput.ErrorMessage); } }
public static LabelTranslation GetOrganizationOneProjectOneLabelOneLabelTranslationOne() { var labelTranslation = new LabelTranslation(); labelTranslation.OrganizationId = OrganizationOneId; labelTranslation.OrganizationUid = OrganizationOneUid; labelTranslation.OrganizationName = OrganizationOneName; labelTranslation.ProjectId = OrganizationOneProjectOneId; labelTranslation.ProjectUid = OrganizationOneProjectOneUid; labelTranslation.ProjectName = OrganizationOneProjectOneName; labelTranslation.LabelId = OrganizationOneProjectOneLabelOneId; labelTranslation.LabelUid = OrganizationOneProjectOneLabelOneUid; labelTranslation.LabelName = OrganizationOneProjectOneLabelOneName; labelTranslation.Id = OrganizationOneProjectOneLabelOneId; labelTranslation.Uid = OrganizationOneProjectOneLabelOneUid; labelTranslation.Name = OrganizationOneProjectOneLabelOneName; return(labelTranslation); }
public LabelTranslationDto CreateDtoFromEntity(LabelTranslation entity) { var dto = new LabelTranslationDto(); dto.Uid = entity.Uid; dto.Translation = entity.Translation; dto.CreatedAt = entity.CreatedAt; dto.UpdatedAt = entity.UpdatedAt; entity.IsActive = entity.IsActive; dto.OrganizationUid = entity.OrganizationUid; dto.OrganizationName = entity.OrganizationName; dto.ProjectUid = entity.ProjectUid; dto.ProjectName = entity.ProjectName; dto.LabelUid = entity.LabelUid; dto.LabelKey = entity.LabelName; dto.LanguageUid = entity.LanguageUid; dto.LanguageName = entity.LanguageName; return(dto); }
void ReleaseDesignerOutlets() { if (ActivityLog != null) { ActivityLog.Dispose(); ActivityLog = null; } if (ButtonPlaySound != null) { ButtonPlaySound.Dispose(); ButtonPlaySound = null; } if (ButtonSaveSound != null) { ButtonSaveSound.Dispose(); ButtonSaveSound = null; } if (LabelDefinitions != null) { LabelDefinitions.Dispose(); LabelDefinitions = null; } if (LabelEndings != null) { LabelEndings.Dispose(); LabelEndings = null; } if (LabelExamples != null) { LabelExamples.Dispose(); LabelExamples = null; } if (LabelPronunciation != null) { LabelPronunciation.Dispose(); LabelPronunciation = null; } if (LabelTranslation != null) { LabelTranslation.Dispose(); LabelTranslation = null; } if (LabelWord != null) { LabelWord.Dispose(); LabelWord = null; } if (txtLookUp != null) { txtLookUp.Dispose(); txtLookUp = null; } if (StackViewOpslagsords != null) { StackViewOpslagsords.Dispose(); StackViewOpslagsords = null; } if (ButtonOpslagsord != null) { ButtonOpslagsord.Dispose(); ButtonOpslagsord = null; } }
public LabelTranslation CreateEntityFromRequest(LabelTranslationEditRequest request, LabelTranslation entity) { entity.Translation = request.NewTranslation; return(entity); }
public void Add(LabelTranslationDao dao) { LabelTranslation entity = _converter.DaoToEntity(dao); _repository.Add(entity); }