public async Task <IActionResult> UpdateTestAgentRunAsync([FromBody] KeyValuePair <int, TestAgentRunDto> updateObject)
        {
            if (updateObject.Value == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entityToBeUpdated = await _meissaRepository.GetByIdAsync <TestAgentRun>(updateObject.Key);

            if (entityToBeUpdated == null)
            {
                return(NotFound());
            }

            ////if (entityToBeUpdated.Status.Equals(TestAgentRunStatus.Completed) && !entityToBeUpdated.Status.Equals(updateObject.Value.Status) && updateObject.Value.Status.Equals(TestAgentRunStatus.Aborted))
            ////{
            ////    return NoContent();
            ////}

            entityToBeUpdated = Mapper.Map(updateObject.Value, entityToBeUpdated);
            await _meissaRepository.UpdateWithSaveAsync(entityToBeUpdated);

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> UpdateTestRunAvailabilityAsync([FromBody] KeyValuePair <int, TestRunAvailabilityDto> updateObject)
        {
            if (updateObject.Value == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entityToBeUpdated = await _meissaRepository.GetByIdAsync <TestRunAvailability>(updateObject.Key);

            if (entityToBeUpdated == null)
            {
                return(NotFound());
            }

            entityToBeUpdated = Mapper.Map(updateObject.Value, entityToBeUpdated);
            await _meissaRepository.UpdateWithSaveAsync(entityToBeUpdated);

            return(NoContent());
        }
Beispiel #3
0
        public async Task <IActionResult> UpdateTestRunAsync([FromBody] KeyValuePair <Guid, TestRunDto> updateObject)
        {
            if (updateObject.Value == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entityToBeUpdated = (await _meissaRepository.GetAllQueryWithRefreshAsync <TestRun>()).FirstOrDefault(x => x.TestRunId.Equals(updateObject.Key));

            if (entityToBeUpdated == null)
            {
                return(NotFound());
            }

            entityToBeUpdated = Mapper.Map(updateObject.Value, entityToBeUpdated);
            await _meissaRepository.UpdateWithSaveAsync(entityToBeUpdated);

            return(NoContent());
        }