Exemplo n.º 1
0
        public async Task <EditableErrorRecord> ById([FromQuery] int id)
        {
            ErrorRecord targetRecord = await _errorRecordRepo.ById(id);

            EditableErrorRecord model = _mapper.Map <EditableErrorRecord>(targetRecord);

            model.AvailableNextStates = _workflowService.GetNextAvailableStates(model.Status);
            return(model);
        }
Exemplo n.º 2
0
        public async Task <int> Create([FromBody] EditableErrorRecord entity)
        {
            if (entity.Id.HasValue)
            {
                throw new ArgumentException($"Can't create record with Id");
            }

            ErrorRecord coreEntity     = _mapper.Map <ErrorRecord>(entity);
            ErrorRecord insertedEntity = await _errorDataService.Insert(coreEntity);

            return(insertedEntity.Id.Value);
        }