Example #1
0
        public async Task <IActionResult> SortTestAction(long targetId, [FromBody] TestActionResource fromActionResource)
        {
            var fromAction           = _mapper.Map <TestActionResource, TestAction>(fromActionResource);
            List <TestAction> result = await _repository.Sort(fromAction, targetId);

            return(Ok(_mapper.Map <List <TestAction>, List <TestActionResource> >(result)));
        }
        public async Task <IActionResult> CreateTestAction([FromBody] TestActionResource resource)
        {
            var testAction = _mapper.Map <TestActionResource, TestAction>(resource);

            _repository.Add(testAction);
            await _unitOfWork.CompleteAsync();

            var result = _mapper.Map <TestAction, TestActionResource>(testAction);

            return(Ok(result));
        }
        public async Task <IActionResult> UpdateTestAction(long id, [FromBody] TestActionResource testActionResource)
        {
            var testAction = await _repository.Get(id);

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

            var result = _mapper.Map <TestActionResource, TestAction>(testActionResource, testAction);
            await _unitOfWork.CompleteAsync();

            return(Ok(result));
        }