示例#1
0
        public async Task <IActionResult> DeleteSportList(SportList newList)
        {
            int success = await _sportListService.DeleteSportListAsync(newList);

            if (success < 0)
            {
                return(NotFound());
            }
            return(RedirectToAction("GetAllSportList"));
        }
示例#2
0
 public async Task <IActionResult> CreateSportList(SportList newList)
 {
     try
     {
         int success = await _sportListService.AddSportListAsync(newList);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     return(RedirectToAction("GetAllSportList"));
 }
        public IApiResponseParsingResult ParseResponse(ParseApiResponse message)
        {
            var responseType = ApiResponseType.Unknown;

            try
            {
                object response;

                var responseXml = DynamicXml.Parse(message.Data);
                responseType = responseXml.GetName();

                switch (responseType)
                {
                case ApiResponseType.CompetitorProfile:
                    response = CompetitorProfile.Parse(responseXml);
                    break;

                case ApiResponseType.FixtureChanges:
                    response = FixtureChangeList.Parse(responseXml);
                    break;

                case ApiResponseType.FixturesFixture:
                    response = FixtureList.Parse(responseXml);
                    break;

                case ApiResponseType.MatchSummary:
                    response = MatchSummary.Parse(responseXml);
                    break;

                case ApiResponseType.MarketDescriptions:
                    response = MarketDescriptionList.Parse(responseXml);
                    break;

                case ApiResponseType.MatchTimeline:
                    response = MatchTimeline.Parse(responseXml);
                    break;

                case ApiResponseType.PlayerProfile:
                    response = PlayerProfile.Parse(responseXml);
                    break;

                case ApiResponseType.RaceTournamentInfo:
                case ApiResponseType.SimpleTournamentInfo:
                case ApiResponseType.StandardTournamentInfo:
                case ApiResponseType.TournamentInfo:
                    response = TournamentInfo.Parse(responseXml);
                    break;

                case ApiResponseType.Response:
                    response = Response.Parse(responseXml);
                    break;

                case ApiResponseType.Schedule:
                    response = Schedule.Parse(responseXml);
                    break;

                case ApiResponseType.SportCategories:
                    response = SportCategoriesList.Parse(responseXml);
                    break;

                case ApiResponseType.Sports:
                    response = SportList.Parse(responseXml);
                    break;

                case ApiResponseType.SportTournaments:
                    response = SportTournamentList.Parse(responseXml);
                    break;

                case ApiResponseType.Tournaments:
                    response = TournamentList.Parse(responseXml);
                    break;

                case ApiResponseType.VenueSummary:
                    response = VenueSummary.Parse(responseXml);
                    break;

                default:
                    throw new NotSupportedException(
                              $"Message of specified type ['{responseType}'] can not be parsed.");
                }

                return(new ApiResponseParsed
                {
                    Language = message.Language,
                    Response = response,
                    RequestId = message.RequestId,
                    EventId = message.EventId,
                    ProductType = message.ProductType
                });
            }
            catch (Exception e)
            {
                throw;
                //return new ApiResponseParsingFailed(
                //    failureReason: e,
                //    requestId: message.RequestId,
                //    responseData: message.Data,
                //    responseType: responseType
                //);
            }
        }
示例#4
0
        public async Task <IActionResult> DetailsSportList(int Id)
        {
            SportList sportList = await _sportListService.SportListById(Id);

            return(View(sportList));
        }
示例#5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public async Task <IActionResult> AddMovements(int Id)
        {
            SportList nList = await _sportListService.SportListById(Id);

            return(View(nList));
        }
示例#6
0
 public async Task <int> DeleteSportListAsync(SportList sportList)
 {
     return(await _sportListRepo.Delete(sportList));
 }
示例#7
0
        public async Task <int> AddSportListAsync(SportList sportList)
        {
            var savedNutritionList = await _sportListRepo.AddEntityAndGetId(sportList);

            SportDay sDay    = null;
            Area     aDay    = null;
            int      success = 0;

            for (int i = 1; i <= 7; i++)
            {
                sDay               = new SportDay();
                sDay.Name          = i + ".Gün";
                sDay.FKSportListId = savedNutritionList.Id;
                sDay               = await _sportDayRepository.AddEntityAndGetId(sDay);

                for (int j = 1; j <= 8; j++)
                {
                    aDay = new Area();
                    if (j == 1)
                    {
                        aDay.Name = "Göğüs";
                    }
                    else if (j == 2)
                    {
                        aDay.Name = "Sırt";
                    }
                    else if (j == 3)
                    {
                        aDay.Name = "Omuz";
                    }
                    else if (j == 4)
                    {
                        aDay.Name = "Ön Kol";
                    }
                    else if (j == 5)
                    {
                        aDay.Name = "Arka Kol";
                    }
                    else if (j == 6)
                    {
                        aDay.Name = "Bacak";
                    }
                    else if (j == 7)
                    {
                        aDay.Name = "Kardiyo";
                    }
                    else
                    {
                        aDay.Name = "Karın";
                    }

                    aDay.FKDayId = sDay.Id;
                    success      = await _areaRepository.Add(aDay);
                }
            }
            if (success > 0)
            {
                return(1);
            }
            return(0);
        }
示例#8
0
        public async Task <SportList> SportListById(int Id)
        {
            SportList getSportList = await _sportListRepo.Get(p => p.Id == Id);

            return(getSportList);
        }
示例#9
0
 public async Task <int> EditSportListAsync(SportList sportList)
 {
     return(await _sportListRepo.Edit(sportList));
 }