public async Task <ActionResult> Post(TextTrailAddRequestDto request) { try { return(Ok(await _textTrailService.Add(request))); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public async Task <int> Add(TextTrailAddRequestDto request) { TextTrail textTrail = _mapper.Map <TextTrail>(request); textTrail.Trail.TypeID = (int)TrailTypeEnum.Text; try { textTrail = await _repository.InsertAsync(textTrail); return(textTrail.Trail.Id); } catch (Exception e) { throw new Exception("Erro ao inserir os dados"); } }