Exemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, MatchScheduleEditBindingModel matchScheduleEditBindingModel)
        {
            if (!this.ModelState.IsValid)
            {
                throw new ArgumentException();
            }

            MatchScheduleServiceModel matchScheduleServiceModel = matchScheduleEditBindingModel.To <MatchScheduleServiceModel>();

            await this.matchScheduleService.EditMatchSchedule(id, matchScheduleServiceModel);

            return(this.Redirect($"/MatchSchedule/All"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(string id)
        {
            var matchScheduleEditBindingModel = await this.matchScheduleService.GetById(id);

            if (matchScheduleEditBindingModel == null)
            {
                //TODO: Error Handling
                return(this.Redirect("/"));
            }

            MatchScheduleEditBindingModel match = new MatchScheduleEditBindingModel
            {
                HomeTeam       = matchScheduleEditBindingModel.HomeTeam,
                GuestTeam      = matchScheduleEditBindingModel.GuestTeam,
                HomeTeamScore  = 0,
                GuestTeamScore = 0,
                MatchDate      = matchScheduleEditBindingModel.MatchDate,
            };

            return(this.View(match));
        }