public ActionResult <Partner> Get(int id)
        {
            var partner = _partnerRepository.GetById(id);

            if (partner == null)
            {
                return(NotFound());
            }
            return(Ok(partner));
        }
        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));
        }
        public IActionResult GetVorbelegung(string sparte, [FromQuery] int partnerId)
        {
            if (sparte.ToLower() != "kraftfahrt")
            {
                return(BadRequest("sparte is invalid"));
            }
            if (partnerId < 1)
            {
                return(BadRequest("bad request, partnerId should be set"));
            }

            var partner = _partnerRepository.GetById(partnerId);

            if (partner == null)
            {
                return(NotFound());
            }
            var result = new
            {
                Geburtsdatum  = partner.Geburtsdatum,
                Anschrift     = partner.Anschrift,
                Zahlungsweise = new List <Zahlungsweise> {
                    new Zahlungsweise
                    {
                        Id   = 1,
                        Name = "monatlich"
                    },
                    new Zahlungsweise
                    {
                        Id   = 2,
                        Name = "jährlich"
                    }
                }
            };

            return(Ok(result));
        }
예제 #4
0
        public async Task <DefaultDataResponse> GetById(Guid partnerId)
        {
            var result = await partnerRepository.GetById(partnerId);

            return(SuccessResponse(result));
        }