Пример #1
0
        async Task GetMatches(int id)
        {
            try
            {
                Loading = true;
                Status  = false;
                RestService.For <IApiServices>(Links.url);
                var response1 = await apiServices.GetFixtures(id);

                Fixture      = response1;
                this.Matches = Fixture.Matches;
                foreach (var item in Matches)
                {
                    var x = Teamm.Where(elemento => elemento.Id == item.HomeTeam.Id).ToList();
                    var y = Teamm.Where(elemento => elemento.Id == item.AwayTeam.Id).ToList();
                }
                Loading = false;
                Status  = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error en el metodo Matches: {ex.Message}");
                Loading = true;
                Status  = false;
            }
        }
        //Retrieve data about matches for selected league//
        async Task GetMatches(int id)
        {
            try
            {
                Loading = true;
                Status  = false;
                RestService.For <IApiServices>(Links.url);

                var fixtures = await apiServices.GetFixtures(id);

                Matches = fixtures.Matches; //Fill list of fixtures//

                foreach (var item in fixtures.Matches)
                {
                    Teamm.Where(element => element.Id == item.HomeTeam.Id);

                    Teamm.Where(element => element.Id == item.AwayTeam.Id);
                }
                Loading = false;
                Status  = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error en el metodo Matches: {ex.Message}");
                Loading = true;
                Status  = false;
            }
        }
Пример #3
0
        private static async Task <ApplicationUser> CreateDefaultUser(UserManager <ApplicationUser> userManager, ILogger <DbInitializer> logger, string email, string donnille, int tenure, Teamm canton)
        {
            logger.LogInformation($"Create default user with email `{email}` for application");
            SharedMethods.SharedMethods.name();
            ApplicationUser user = new ApplicationUser
            {
                GivenName  = SharedMethods.SharedMethods.name()["PN"],
                FamilyName = SharedMethods.SharedMethods.name()["SN"],
                Tenure     = new DateTime(tenure, 1, 1),
                DonNille   = donnille,
                Canton     = canton,
                Email      = email,
                UserName   = email
            };

            IdentityResult identityResult = await userManager.CreateAsync(user);

            if (identityResult.Succeeded)
            {
                logger.LogDebug($"Created default user `{email}` successfully");
            }
            else
            {
                ApplicationException exception = new ApplicationException($"Default user `{email}` cannot be created");
                //logger.LogError(exception, GetIdentiryErrorsInCommaSeperatedList(identityResult));
                throw exception;
            }

            ApplicationUser createdUser = await userManager.FindByEmailAsync(email);

            return(createdUser);
        }