예제 #1
0
        public IActionResult Put(int id, [FromBody] Party party)
        {
            if (id != party.Id)
            {
                return(BadRequest());
            }

            if (_partyService.GetPartyByID(id) == null)
            {
                return(NotFound());
            }

            _partyService.UpdateParty(party);

            return(CreatedAtAction(nameof(Get), new { id = party.Id }, party));
        }
예제 #2
0
        // GET: Party
        public ActionResult Index(int id)
        {
            Party party = partyService.GetPartyByID(id);

            PartyParticipantsViewModel partyParticipantsViewModel = new PartyParticipantsViewModel();

            partyParticipantsViewModel.PartyID           = id;
            partyParticipantsViewModel.PartyTitle        = party.Title;
            partyParticipantsViewModel.PartyParticipants = partyService.ListAttendent().Where(_ => _.PartyId == id).Select(_ => new PartyParticipants {
                Id = _.Id, Name = _.Name, ArrivalDate = _.ArrivalDate
            }).ToList();

            return(View(partyParticipantsViewModel));
        }
예제 #3
0
        public Task <Party> Handle(PartyQuery request, CancellationToken cancellationToken)
        {
            Party party = _partyService.GetPartyByID(request.Id);

            return(Task.FromResult(party));
        }