Ejemplo n.º 1
0
        public async Task <ActionResult <Owner> > PostOwner(CreateOwnerCommand command)
        {
            var result = await _mediator.Send(command);

            return(ResponseHelpers.BuildCreatedAtResponse(
                       this,
                       result,
                       nameof(GetOwner),
                       () => new { id = result.Content.Id }));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <int> > PostRace(CreateRaceCommand race)
        {
            var result = await _mediator.Send(race);

            return(ResponseHelpers.BuildCreatedAtResponse(
                       this,
                       result,
                       nameof(GetRace),
                       () => new { id = result.Content }));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <FantasyTeam> > PostFantasyTeam(CreateFantasyTeamCommand command)
        {
            var result = await _mediator.Send(command);

            return(ResponseHelpers.BuildCreatedAtResponse(
                       this,
                       result,
                       nameof(GetFantasyTeam),
                       () => new { id = result.Content.Id }));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <int> > PostTrack(CreateTrackCommand track)
        {
            if (_context.Tracks.Any(e => e.NascarId == track.NascarId))
            {
                return(Conflict());
            }

            var result = await _mediator.Send(track);

            return(ResponseHelpers.BuildCreatedAtResponse(
                       this,
                       result,
                       nameof(GetTrack),
                       () => new { id = result.Content }));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult <GetRaceStageByIdVm> > PostRaceStage(int raceId, CreateRaceStageCommand command)
        {
            if (command.RaceId != raceId)
            {
                return(BadRequest());
            }

            var result = await _mediator.Send(command);

            return(ResponseHelpers.BuildCreatedAtResponse(
                       this,
                       result,
                       nameof(GetRaceStage),
                       () => new { raceId, stageId = result.Content.Id }));
        }