public void Inheritence()
            {
                var response = new VariableResponseDto();

                response.Should().NotBeNull();
                response.Should().BeAssignableTo <IVariable>();
                response.Should().BeAssignableTo <ErrorDetail>();
                response.Should().BeOfType <VariableResponseDto>();
            }
        public VariableResponseDto Execute(CreateVariableInputDto Variable)
        {
            var VariableResponse = new VariableResponseDto();

            try
            {
                Log.Information("Creating Variable Entry for [{NewName}].", Variable?.Name);
                var VariableEntity = Mapper.Map <CreateVariableInputDto, Variable>(Variable);
                VariableResponse            = Mapper.Map(Repository.Create(VariableEntity), VariableResponse);
                VariableResponse.StatusCode = 200;
            }
            catch (Exception exception)
            {
                Log.Error(exception, "Failed to Create Variable: [{NewName}].", Variable?.Name);
                HandleErrors(VariableResponse, exception);
            }
            return(VariableResponse);
        }
Example #3
0
        public async Task <VariableResponseDto> ExecuteAsync(CreateVariableInputDto input)
        {
            var VariableResponse = new VariableResponseDto();

            try
            {
                Log.Information("Creating Variable Entry for [{NewName}]...", input?.Name);
                var variableEntity = Mapper.Map <CreateVariableInputDto, Variable>(input);
                VariableResponse            = Mapper.Map(await Repository.CreateAsync(variableEntity), VariableResponse);
                VariableResponse.StatusCode = 200;
                Log.Information("Created Variable Entry for [{NewName}] with Id: [{Id}]", VariableResponse.Name, VariableResponse.Id);
            }
            catch (Exception exception)
            {
                Log.Error(exception, "Failed to Create Variable: [{NewName}].", input?.Name);
                HandleErrors(VariableResponse, exception);
            }
            return(VariableResponse);
        }