Exemple #1
0
        public async Task <ActionResult <ClubModel> > Put(UpdateClubCommand request)
        {
            var club = await Mediator.Send(request);

            if (club is null)
            {
                return(NotFound());
            }
            return(Ok(club));
        }
Exemple #2
0
        public async Task <ActionResult> Update(int id, UpdateClubCommand command)
        {
            if (id != command.Id)
            {
                return(BadRequest());
            }

            await Mediator.Send(command);

            return(NoContent());
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }