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); }
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); }