public ActionResult <InvestigationToRoundDto> AttachRound([FromBody] InvestigationToRoundDto dto) { try { if (dto is null) { return(BadRequest("attach can't be null")); } var round = new InvestigationToRoundMapper().ToModel(dto); var send = _unitOfWork.InvestigationToRounds.Add(round); _unitOfWork.Save(); var result = new InvestigationToRoundMapper().ToDto(send); return(CreatedAtAction(nameof(GetRound), new { id = result.InvestigationToRoundId }, result)); } catch (Exception e) { throw new HttpRequestException(e.Message, e, HttpStatusCode.InternalServerError); } }
public async Task <InvestigationToRoundDto> AttachRoundAsync(InvestigationToRoundDto round) { return(await new HttpRequestService <InvestigationToRoundDto>().CreateAsync(round, _roundUrl, Api)); }