Exemplo n.º 1
0
        public async Task <IActionResult> SaveEntity(SaveTestRequest saveTestRequest)
        {
            var testEntity = _mapper.Map <Test>(saveTestRequest);
            await _testService.SaveEntity(testEntity);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SaveTest(SaveTestRequest request)
        {
            var test = await Db.Cases.FirstOrDefaultAsync(c => c.TestId == request.TestId);

            if (test?.State == TestCaseState.RecordedButNotSaved)
            {
                test.AuthorName      = request.AuthorName;
                test.TestDescription = request.Description;
                test.TestName        = request.Name;
                test.State           = TestCaseState.Saved;
                await Db.SaveChangesAsync();

                MessageProducer.FireTestAdded(new TestAddedMessage(test.TestId, test.TestName, test.AuthorName));

                return(Ok(new SaveTestResponse()));
            }
            else
            {
                return(NotFound());
            }
        }