Пример #1
0
        public async Task <ActionResult> UpdateTeam()
        {
            TeamApiModel model = new TeamApiModel();

            model.Title  = "Team 100";
            model.TeamID = 1;
            var allteam = await client.Update(model);

            return(View());
        }
Пример #2
0
        public Mannschaft Map(TeamApiModel apiModel)
        {
            var result = new Mannschaft
            {
                TeamId        = apiModel.TeamId,
                Kurzname      = apiModel.TeamName,
                Vereinsnummer = apiModel.ClubCode,
                Langname      = apiModel.ClubName
            };

            return(result);
        }
Пример #3
0
        public async Task Post_ReturnsOkResult_WhenModelIsValid()
        {
            var userId = Guid.NewGuid();

            SetupRequestHeader(_sut, userId);

            var model = new TeamApiModel {
                Owner = new UserApiModel {
                    Id = userId
                }
            };

            var result = await _sut.Post(model);

            Assert.IsType(typeof(OkObjectResult), result);
        }
Пример #4
0
        public async Task <IActionResult> Post([FromBody] TeamApiModel teamApiModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            teamApiModel.Owner = await GetRemoteUserAsync(teamApiModel.Owner.Id);

            var teamDto = _mapper.Map <TeamDto>(teamApiModel);
            var id      = await _teamService.CreateAsync(CurrentUserId, teamDto);

            _logger.LogInformation($"New team {teamApiModel.Name} was created");

            return(Ok(id));
        }
Пример #5
0
        public async Task <IActionResult> Create(TeamViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Board", "Ticket"));
            }

            var team = new TeamApiModel
            {
                Name  = model.Name,
                Owner = new UserApiModel {
                    Id = User.GetUserId()
                }
            };

            var id = await _communicationService.PostAsync <string, TeamApiModel>("user/teams", team, FormHeaders(JsonType), "teamapi");

            return(RedirectToAction("Board", "Ticket", new { teamId = new Guid(id) }));
        }
Пример #6
0
        public async Task <TeamResponse.UpdateResponse> Update(TeamApiModel model)
        {
            var response = await PutEncodedContentWithSimpleResponse <TeamResponse.UpdateResponse, DefaultResponseApiModel, TeamApiModel>(generalUri, model);

            return(response);
        }
        public async Task <TeamApiModel> CreateUpdateTeam(TeamApiModel team)
        {
            var response = await ApiClient.PostJsonEncodedContent(CreateUpdateTeamUri, team);

            return(await DecodeContent <TeamApiModel>(response));
        }