public ActionResult <Vertrag> Get(int id) { var vertrag = _vertragRepository.GetByVsnr(id); if (vertrag == null) { return(NotFound()); } return(Ok(vertrag)); }
public IActionResult GetVorbelegung(string sparte, [FromQuery] int partnerId, [FromQuery] int vsnr) { if (sparte.ToLower() != "kraftfahrt") { return(BadRequest("sparte is invalid")); } if (partnerId < 1) { return(BadRequest("bad request, partnerId should be set")); } if (vsnr < 1) { return(BadRequest("bad request, vsnr should be set")); } var partner = _partnerRepository.GetById(partnerId); if (partner == null) { return(NotFound()); } var vertrag = _vertragRepository.GetByVsnr(vsnr); if (vertrag == null) { return(NotFound()); } var result = new { Vsnr = vertrag.Vsnr, Anschrift = partner.Anschrift }; return(Ok(result)); }