public async Task <ActionResult <ClubModel> > Put(UpdateClubCommand request) { var club = await Mediator.Send(request); if (club is null) { return(NotFound()); } return(Ok(club)); }
public async Task <ActionResult> Update(int id, UpdateClubCommand command) { if (id != command.Id) { return(BadRequest()); } await Mediator.Send(command); return(NoContent()); }
public void DeleteClub(UpdateClubCommand deletedClubCommand, int id) { var repo = new ClubRepository(); var deletedClub = new Club { Name = deletedClubCommand.Name, Address = deletedClubCommand.Address, Phone = deletedClubCommand.Phone, Capacity = deletedClubCommand.Capacity, Description = deletedClubCommand.Description }; repo.DeleteClub(deletedClub, id); }
public void UpdateClub(UpdateClubCommand updatedClubCommand, int id) { var repo = new ClubRepository(); var updatedClub = new Club { Name = updatedClubCommand.Name, Address = updatedClubCommand.Address, Phone = updatedClubCommand.Phone, Capacity = updatedClubCommand.Capacity, Description = updatedClubCommand.Description }; repo.UpdateClub(updatedClub, id); }