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)); }
// 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)); }
public Task <Party> Handle(PartyQuery request, CancellationToken cancellationToken) { Party party = _partyService.GetPartyByID(request.Id); return(Task.FromResult(party)); }