public async Task <OperationResult> ChangeStatus(SurveyConfigUpdateStatusModel configUpdateStatusModel) { try { var core = await _coreHelper.GetCore(); await using var sdkContext = core.DbContextHelper.GetDbContext(); var surveyConfiguration = await sdkContext.SurveyConfigurations .Where(x => x.Id == configUpdateStatusModel.Id) .Where(x => x.WorkflowState != Constants.WorkflowStates.Removed) .FirstOrDefaultAsync(); if (surveyConfiguration == null) { return(new OperationResult( false, _localizationService.GetString("SurveyConfigurationNotFound"))); } // TODO Change status var message = configUpdateStatusModel.IsActive ? "SurveyConfigurationHasBeenActivated" : "SurveyConfigurationHasBeenDeactivated"; return(new OperationResult( true, _localizationService.GetString(message))); } catch (Exception e) { Trace.TraceError(e.Message); _logger.LogError(e.Message); return(new OperationResult( false, _localizationService.GetString("ErrorWhileChangingSurveyConfigurationStatus"))); } }
public async Task <OperationResult> ChangeStatus([FromBody] SurveyConfigUpdateStatusModel configUpdateStatusModel) { return(await _surveysService.ChangeStatus(configUpdateStatusModel)); }