Beispiel #1
0
 public AdminController(BettingContext context)
 {
     _matchRepository  = new MatchRepository(context);
     _teamRepository   = new TeamRepository(context);
     _sportRepository  = new SportRepository(context);
     _ticketRepository = new TicketRepository(context);
 }
        public async Task <IActionResult> PostAsync([FromBody] Sport sport)
        {
            var sportRep = new SportRepository(_db);
            var result   = await sportRep.SaveSport(sport);

            return(NoContent());
        }
Beispiel #3
0
        private void PopulateEventComboBox()
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;


            EventViewComboBox.Items.Clear();
            SqlCeCommand cmd = Connection.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT * FROM Event";
            cmd.ExecuteNonQuery();
            DataTable        dt = new DataTable();
            SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);

            da.Fill(dt);

            foreach (DataRow dr in dt.Rows)
            {
                int team1  = Int16.Parse(dr["Team_Id"].ToString());
                int team2  = Int16.Parse(dr["Team_Id1"].ToString());
                int game1  = Int16.Parse(dr["Game_type_Id"].ToString());
                int sport1 = Int16.Parse(dr["Sport_Id"].ToString());
                int leage1 = Int16.Parse(dr["League_Id"].ToString());

                string team11   = TeamRepository.GetTeamNameById(team1);
                string team22   = TeamRepository.GetTeamNameById(team2);
                string game11   = GameTypeRepository.GetGameTypeMarkById(game1);
                string sport11  = SportRepository.GetSportNameById(sport1);
                string league11 = LeagueRepository.GetLeagueNameById(leage1);

                EventViewComboBox.Items.Add(sport11 + " - " + league11 + " - " + team11 + " - " + team22 + " - " + dr["Time"].ToString() + " - " + game11 + " - " + dr["Quota"].ToString() + "KM ");
            }
            EventViewComboBox.SelectedIndex = 0;
        }
Beispiel #4
0
 public TeamManagerController(
     SportRepository sportRepository,
     TeamRepository teamRepository,
     AthleteRepository athleteRepository)
 {
     this.sportRepository   = sportRepository;
     this.teamRepository    = teamRepository;
     this.athleteRepository = athleteRepository;
 }
Beispiel #5
0
 public void TestInit()
 {
     contextFactory = GetContextFactory();
     repo           = new SportRepository(contextFactory);
     boca           = CreateBocaTeam();
     river          = CreateTeamThatBelongsInTheB();
     futbol         = CreateFutbolTeam();
     rugby          = CreateRugbyTeam();
     repo.Add(futbol);
     repo.Add(rugby);
 }
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (NameSportTextBox.Text == "")
     {
         MessageBox.Show("Unesite vrstu sport!!!");
     }
     else
     {
         string text = NameSportTextBox.Text;
         SportRepository.AddSport(text);
     }
 }
Beispiel #7
0
        public async void DoesSportExist_addSportReturnFalse()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.False(repository.DoesSportExist(sport.SportName + ' '));
            }
        }
Beispiel #8
0
        public async void SportIdExists_ReturnTrue()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.True(repository.SportIdExists(sport.SportId));
            }
        }
 public WebPortalUnitOfWork(DbConnectionString webPortalConnectionString)
 {
     Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
     _webPortalConnectionString    = webPortalConnectionString;
     MatchRepository               = new MatchRepository(_webPortalConnectionString);
     SportRepository               = new SportRepository(_webPortalConnectionString);
     TeamRepository                = new TeamRepository(_webPortalConnectionString);
     PlayerRepository              = new PlayerRepository(_webPortalConnectionString);
     ScrapingInformationRepository = new ScrapingInformationRepository(_webPortalConnectionString);
     ProviderRepository            = new ProviderRepository(_webPortalConnectionString);
     PlayerOverUnderRepository     = new PlayerOverUnderRepository(_webPortalConnectionString);
     PlayerHeadToHeadRepository    = new PlayerHeadToHeadRepository(_webPortalConnectionString);
     TempTableToTestRepository     = new TempTableToTestRepository(_webPortalConnectionString);
 }
Beispiel #10
0
        public async void AddAsync_AddAsyncToConext()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.Equal(1, await context.Sport.CountAsync());
                Assert.Equal(sport, await context.Sport.SingleAsync());
            }
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;

            try
            {
                if (QuotaTextBox.Text == "")
                {
                    MessageBox.Show("Uneste iznos kvote!");
                }
                else if (EventDateTimePicker.Text == "")
                {
                    MessageBox.Show("Unesite vrijeme dogadjaja!");
                }

                else
                {
                    int SportID    = SportRepository.GetIdByNameSport(SportIDComboBox.Text);
                    int TeamID     = TeamRepository.GetIdByNameTeam(TeamIDComboBox.Text);
                    int LeagueID   = LeagueRepository.GetIdByNameLeague(LeagueIDComboBox.Text);
                    int GameTypeID = GameTypeRepository.GetIdByNameGameType(GameTypeIDComboBox.Text);
                    int TeamID1    = TeamRepository.GetIdByNameTeam(TeamID1ComboBox.Text);


                    SqlCeCommand command1 = new SqlCeCommand("INSERT INTO Event (Sport_Id, Team_Id, Time, League_Id, Game_type_Id, Quota, Team_Id1) VALUES" + " ('" + SportID + "', '" + TeamID + "', '" + EventDateTimePicker.Value.Date.ToString("yyyy-MM-dd") + "', '" + LeagueID + "', '" + GameTypeID + "',  '" + QuotaTextBox.Text + "',  '" + TeamID1 + "'); ", Connection);


                    /*SqlCeCommand command1 = new SqlCeCommand(@"INSERT INTO Event (Sport_Id, Team_Id, Time, League_Id, Game_type_Id, Quota, Team_Id1) VALUES (@sportId, @teamId, @time, @leagueId, @gameTypeId, @quota, @teamId1)", Connection);
                     * command1.Parameters.AddWithValue("@sportId", SportID);
                     * command1.Parameters.AddWithValue("@teamId", TeamID);
                     * command1.Parameters.AddWithValue("@time", DateTime.Now.Date.ToString());
                     * command1.Parameters.AddWithValue("@leagueId", LeagueID);
                     * command1.Parameters.AddWithValue("@gameTypeId", GameTypeID);
                     * command1.Parameters.AddWithValue("@quota", QuotaTextBox.Text);
                     * command1.Parameters.AddWithValue("@teamId1", TeamID1);*/


                    command1.ExecuteNonQuery();
                    MessageBox.Show("Unos je uspio!");
                    QuotaTextBox.Clear();
                    QuotaTextBox.Focus();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Unos nije uspio! \r Greska: " + ex.Message);
                return;
            }
        }
        public async Task <Sport> UpdateAsync(int id, Sport Sport)
        {
            SportRepository sportRepository = new SportRepository(_db);

            var results = await sportRepository.UpdateSport(Sport);

            if (results > 0)
            {
                Message = "Sport  successfully updated";
            }
            else
            {
                Message = "Something went wrong";
            }

            return(Sport);
        }
Beispiel #13
0
        public async void GetAllAsync_ReturnsAllFromContext()
        {
            var expectedSports = SportGenerator.CreateList();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                context.Sport.AddRange(expectedSports);
                context.SaveChanges();

                Assert.Equal(expectedSports.Count, await context.Sport.CountAsync());

                var repository = new SportRepository(context);
                var resources  = repository.GetAllAsync();

                Assert.IsAssignableFrom <IQueryable <Sport> >(resources);
                Assert.Equal(expectedSports, resources);
            }
        }
        internal static void StatisticsForEachSport() //KLART
        {
            var cRep  = new SportRepository();
            var stats = cRep.SportStatisticsAsync();
            var mRep  = new ContestantRepository();
            var stat  = mRep.GetAllAsync();


            var totalContestants = 0;

            foreach (var x in stats.Result)
            {
                int contestants = x.Contestants.Count;
                totalContestants += contestants;
            }
            Console.WriteLine("Statistics for each Sport: \n");
            foreach (var y in stats.Result)
            {
                int    male     = 0;
                int    female   = 0;
                int    sportid  = y.Id;
                int    x        = y.Contestants.Count;
                int    contests = y.Contests.Count();
                int    match    = 0;
                double percent  = x * 100 / totalContestants;
                foreach (var z in stat.Result.Where(s => s.Gender.StartsWith("male") && s.SportId == sportid))
                {
                    male = z.FirstName.Count();
                }
                foreach (var z in stat.Result.Where(s => s.Gender.StartsWith("female") && s.SportId == sportid))
                {
                    female = z.FirstName.Count();
                }
                foreach (var z in stat.Result.Where(s => s.SportId == sportid))
                {
                    match = z.Matches.Count();
                }
                Console.WriteLine("{0} has {1} % of the participants", y.SportName, percent);
                Console.WriteLine("{0} has {1} male and {2} female contestants. ", y.SportName, male, female);
                Console.WriteLine("{0} has {1} contests. ", y.SportName, contests);
                Console.WriteLine("{0} has {1} scheduled matches.\n ", y.SportName, match);
            }
        }
Beispiel #15
0
        private void DeleteSportButton_Click(object sender, EventArgs e)
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;


            DialogResult dr = MessageBox.Show("Da li želite da izbrišete ?", "Brisanje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dr == DialogResult.Yes)
            {
                string name = SportViewComboBox.SelectedItem.ToString();

                SportRepository.DeleteDataSport(name);
                SportViewComboBox.Items.Remove(SportViewComboBox.SelectedItem);
            }

            else if (dr == DialogResult.No)
            {
            }
        }
Beispiel #16
0
        public async void DeleteAsync_DeleteFromContext()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                var repository = new SportRepository(context);
                context.Database.EnsureCreated();
                context.Sport.Add(sport);
                context.SaveChanges();
                Assert.Equal(1, await context.Sport.CountAsync());



                await repository.DeleteAsync(sport);

                Assert.Equal(0, await context.Sport.CountAsync());
            }
        }
Beispiel #17
0
        public async void UpdateAsync_UpdatesInContext()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                context.Sport.Add(sport);
                context.SaveChanges();
                var repository = new SportRepository(context);
                var newSport   = await repository.GetByIdAsync(sport.SportId);

                newSport.SportName = "Hockey";

                await repository.UpdateAsync(newSport);

                Assert.Equal(1, await context.Sport.CountAsync());
                Assert.Equal(newSport, await context.Sport.SingleAsync());
            }
        }
Beispiel #18
0
        public async void GetByIdAsync_ReturnsCorrectItems()
        {
            var list     = SportGenerator.CreateList(5);
            var expected = list[2];

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                context.Sport.AddRange(list);

                await context.SaveChangesAsync();

                Assert.True(true);
                Assert.Equal(list.Count, await context.Sport.CountAsync());
                var repository = new SportRepository(context);
                var sport      = await repository.GetByIdAsync(expected.SportId);

                Assert.IsType <Sport>(sport);
                Assert.Equal(expected, sport);
            }
        }
Beispiel #19
0
        public void ShouldGetAllSports()
        {
            var options = new DbContextOptionsBuilder <ASMembershipContext>()
                          .UseInMemoryDatabase("ShouldGetAllSports")
                          .Options;

            var sports = GetTestSports();

            using (var context = new ASMembershipContext(options))
            {
                context.Sports.AddRange(sports);
                context.SaveChanges();
            }

            using (var context = new ASMembershipContext(options))
            {
                var sportRepository = new SportRepository(context);
                var result          = sportRepository.GetAll();

                Assert.Equal(sports.Count, result.Count);
            }
        }
Beispiel #20
0
 public MatchesController(BettingContext context)
 {
     _matchRepository = new MatchRepository(context);
     _sportRepository = new SportRepository(context);
 }
Beispiel #21
0
 public AthleteController(AthleteRepository athleteRepository, SportRepository sportRepository)
 {
     _athleteRepository = athleteRepository;
     _sportRepository   = sportRepository;
 }
 public void Delete(int id)
 {
     var SportRep = new SportRepository(_db);
     var Result   = SportRep.DeleteSport(id);
 }
Beispiel #23
0
        // Lägger till Basic data samt till one to many tabeller.
        // För övrigt gäller samma kommentarer som till metoden under.
        internal static void AddBasicData(string olympicModel, string contestantFirstName, string contestantLastName, int age,
                                          string gender, string country, string sport, string contestName, string refereeName) //KLAR
        {
            int sportID      = 0;
            int countryID    = 0;
            int contestID    = 0;
            int refereeID    = 0;
            int contestantID = 0;

            var conRep = new ContestantRepository();
            var conId  = conRep.FindBy(m => m.FirstName.Equals(contestantFirstName) && m.LastName.Equals(contestantLastName));

            foreach (var c in conId)
            {
                contestantID = c.Id;
            }
            var cRep = new CountryRepository();
            var cId  = cRep.FindBy(m => m.CountryName.StartsWith(country));

            foreach (var c in cId)
            {
                countryID = c.Id;
            }

            var sRep = new SportRepository();
            var sId  = sRep.FindBy(m => m.SportName.Equals(sport));

            foreach (var c in sId)
            {
                sportID = c.Id;
            }
            var coRep = new ContestRepository();
            var coId  = coRep.FindBy(m => m.ContestName.Equals(contestName));

            foreach (var c in coId)
            {
                contestID = c.Id;
            }
            var reRep = new RefereeRepository();
            var reId  = reRep.FindBy(m => m.Name.Equals(refereeName));

            foreach (var c in reId)
            {
                refereeID = c.Id;
            }
            try
            {
                if (olympicModel == "Country" && countryID == 0)
                {
                    var addCountry = new CountryRepository();
                    addCountry.Add(new Country {
                        CountryName = country
                    });
                    addCountry.Save();
                }
            }
            catch
            {
                Console.WriteLine("{0} already exists in db.", olympicModel);
            }
            try
            {
                if (olympicModel == "Sport" && sportID == 0)
                {
                    var addSport = new SportRepository();
                    addSport.Add(new Sport {
                        SportName = sport
                    });
                    addSport.Save();
                }
            }
            catch
            {
                Console.WriteLine("{0} already exists in db.", olympicModel);
            }
            try
            {
                if (olympicModel == "Contest" && contestID == 0 && sportID != 0)
                {
                    var addContest = new ContestRepository();
                    addContest.Add(new Contest {
                        ContestName = contestName, SportId = sportID
                    });
                    addContest.Save();
                }
                else if (olympicModel == "Contest" && contestID != 0)
                {
                    Console.WriteLine("{0} already exists in db.", olympicModel);
                }
            }
            catch
            {
                Console.WriteLine("{0} is not added yet. You have to register OlympicModel: {1}, first.", olympicModel, sport);
            }
            try
            {
                if (olympicModel == "Contestant" && contestantID == 0 && sportID != 0 && countryID != 0)
                {
                    var addContestant = new ContestantRepository();
                    addContestant.Add(new Contestant {
                        FirstName = contestantFirstName, LastName = contestantLastName, Age = age, CountryId = countryID, Gender = gender, SportId = sportID
                    });
                    addContestant.Save();
                }
                else if (olympicModel == "Contestant" && contestantID != 0)
                {
                    Console.WriteLine("{0} already exists in db.", olympicModel);
                }
            }
            catch
            {
                Console.WriteLine("This sport or country is not added yet. Select OlympicModel: Sport/Country, first.");
            }
            try
            {
                if (olympicModel == "Referee" && refereeID == 0 && countryID != 0)
                {
                    var addReferee = new RefereeRepository();
                    addReferee.Add(new Referee {
                        Name = refereeName, CountryId = countryID
                    });
                    addReferee.Save();
                    Console.WriteLine("Data is now added!");
                }
            }
            catch
            {
                Console.WriteLine("This country is not added yet. Select OlympicModel: Country, first.");
                Console.ReadKey();
            }
            if (olympicModel == "Match")
            {
                Console.WriteLine("This method doesen't work for many to many. Select AddManyToMany(), instead.");
            }
        }
 public SportController()
 {
     _sportRepository = new SportRepository();
 }
Beispiel #25
0
 public SportController(SportRepository sportRepository)
 {
     _sportRepository = sportRepository;
 }
Beispiel #26
0
 public SportController(SportRepository repository)
 {
     this.repository = repository;
 }
Beispiel #27
0
        //Tar bort ett id och dess barn. Förutom i två tabeller, där jag gjorde fel i migreringen och inte lyckades rätta till det.
        // Se kommentarer på rad 81 i OlympicContext.
        internal static void DeleteBasicData(string olympicModel, string contestantFirstName, string contestantLastName, string country, string sport, string contestName, string refereeName)
        {
            var mRep = new MatchRepository();


            if (olympicModel == "Country")
            {
                try                         // Denna nödlösning för jag misslyckades att ändra Restict till Cascade i min sista migration.
                {
                    var cRep = new CountryRepository();
                    var co   = cRep.FindBy(c => c.CountryName == country);
                    cRep.DeleteRange(co);
                    cRep.Save();
                    return;
                }
                catch
                {
                    var match = mRep.FindBy(m => m.Contestant.Country.CountryName.Equals(country));
                    foreach (var x in match)
                    {
                        Console.WriteLine("Match with keyvaluepairs: " + x.ContestId + " - " + x.ContestantId + " has to be deleted first.");
                    }
                    return;
                }
            }
            if (olympicModel == "Sport")
            {
                var cRep = new SportRepository();
                var co   = cRep.FindBy(c => c.SportName == sport);
                cRep.DeleteRange(co);
                cRep.Save();
                return;
            }
            if (olympicModel == "Referee")
            {
                var cRep = new RefereeRepository();
                var co   = cRep.FindBy(c => c.Name == refereeName);
                cRep.DeleteRange(co);
                cRep.Save();
                return;
            }
            if (olympicModel == "Contest")
            {
                var cRep = new ContestRepository();
                var co   = cRep.FindBy(c => c.ContestName == contestName);
                cRep.DeleteRange(co);
                cRep.Save();
                return;
            }
            if (olympicModel == "Contestant")
            {
                try                          // Denna nödlösning för jag misslyckades att ändra Restict till Cascade i min sista migration. (Tror jag i alla fall)
                {
                    var cRep = new ContestantRepository();
                    var co   = cRep.FindBy(c => c.FirstName == contestantFirstName && c.LastName == contestantLastName);
                    cRep.DeleteRange(co);
                    cRep.Save();
                    return;
                }
                catch
                {
                    var match = mRep.FindBy(m => m.Contestant.FirstName.Equals(contestantFirstName) && m.Contestant.LastName.Equals(contestantLastName));
                    foreach (var x in match)
                    {
                        Console.WriteLine("Match with keyvaluepairs: " + x.ContestId + " - " + x.ContestantId + " has to be deleted first.");
                    }
                    return;
                }
            }
            else
            {
                System.Console.WriteLine("{0} does not exist in database.", olympicModel);
            }
        }
        //Uppdaterar data i grundtabeller och one to many. Använder consolen i brist på web.
        internal static void UpdateBasicData(string parameter) //KLAR
        {
            var spRep = new SportRepository();
            var alls  = spRep.GetAll();
            var coRep = new CountryRepository();
            var allc  = coRep.GetAll();

            if (parameter == "Contestant")
            {
                var mRep = new ContestantRepository();
                var all  = mRep.GetAll();
                foreach (var x in all)
                {
                    Console.WriteLine("Id " + x.Id + ":\t" + "FirstName: " + x.FirstName
                                      + "\t" + "LastName: " + x.LastName + "\t" + "Age " + x.Age + "\t" + "Gender "
                                      + x.Gender + "\t" + "CountryId " + x.CountryId + "\t" + "SportId " + x.SportId);
                }
                int id     = UpdateId();
                var change = mRep.FindBy(m => m.Id.Equals(id));
                foreach (var x in change)
                {
                    Console.Write("Enter new FirstName: ");
                    x.FirstName = Console.ReadLine();
                    Console.Write("Enter new LastName: ");
                    x.LastName = Console.ReadLine();
                    Console.Write("Enter new Age: ");
                    x.Age = int.Parse(Console.ReadLine());
                    Console.Write("Enter new Gender (male/female): ");
                    x.Gender = Console.ReadLine();
                    foreach (var y in allc)
                    {
                        Console.WriteLine(y.Id + " = " + y.CountryName);
                    }

                    Console.Write("Enter new CountryId: ");
                    x.CountryId = int.Parse(Console.ReadLine());
                    foreach (var y in alls)
                    {
                        Console.WriteLine(y.Id + " = " + y.SportName);
                    }
                    Console.Write("Enter new SportId: ");
                    x.SportId = int.Parse(Console.ReadLine());
                    mRep.Update(x);
                    mRep.Save();
                }
            }
            if (parameter == "Contest")
            {
                var mRep = new ContestRepository();
                var all  = mRep.GetAll();
                foreach (var x in all)
                {
                    Console.WriteLine("Id " + x.Id + ":\t" + "ContestName: " + x.ContestName + "\t\t" + "SportId " + x.SportId);
                }
                int id     = UpdateId();
                var change = mRep.FindBy(m => m.Id.Equals(id));
                foreach (var x in change)
                {
                    Console.Write("Enter new ContestName: ");
                    x.ContestName = Console.ReadLine();
                    foreach (var y in alls)
                    {
                        Console.WriteLine(y.Id + " = " + y.SportName);
                    }
                    Console.Write("Enter new SportId: ");
                    x.SportId = int.Parse(Console.ReadLine());
                    mRep.Update(x);
                    mRep.Save();
                }
            }
            if (parameter == "Sport")
            {
                foreach (var x in alls)
                {
                    Console.WriteLine("Id " + x.Id + ":\t" + "SportName: " + x.SportName);
                }
                int id = UpdateId();

                var change = spRep.FindBy(m => m.Id.Equals(id));
                foreach (var x in change)
                {
                    Console.Write("Enter new SportName: ");
                    x.SportName = Console.ReadLine();
                    spRep.Update(x);
                    spRep.Save();
                }
            }
            if (parameter == "Country")
            {
                foreach (var x in allc)
                {
                    Console.WriteLine("Id " + x.Id + ":\t" + "CountryName " + x.CountryName + "\t\t" + "Gold " + x.Gold + "\t" + "Silver " + x.Silver + "\t" + "Bronze " + x.Bronze);
                }
                int id     = UpdateId();
                var change = coRep.FindBy(m => m.Id.Equals(id));
                foreach (var x in change)
                {
                    Console.Write("Enter new CountryName: ");
                    x.CountryName = Console.ReadLine();
                    Console.Write("Enter new Gold: ");
                    x.Gold = int.Parse(Console.ReadLine());
                    Console.Write("Enter new Silver: ");
                    x.Silver = int.Parse(Console.ReadLine());
                    Console.Write("Enter new Bronze: ");
                    x.Bronze = int.Parse(Console.ReadLine());
                    coRep.Update(x);
                    coRep.Save();
                }
            }
            if (parameter == "Referee")
            {
                var mRep = new RefereeRepository();
                var all  = mRep.GetAll();
                foreach (var x in all)
                {
                    Console.WriteLine("Id " + x.Id + ":\t" + "Name: " + x.Name + "\t\t" + "CountryId " + x.CountryId);
                }
                int id     = UpdateId();
                var change = mRep.FindBy(m => m.Id.Equals(id));
                foreach (var x in change)
                {
                    Console.Write("Enter new Name: ");
                    x.Name = Console.ReadLine();
                    foreach (var y in allc)
                    {
                        Console.WriteLine(y.Id + " = " + y.CountryName);
                    }
                    Console.Write("Enter new CountryId: ");
                    x.CountryId = int.Parse(Console.ReadLine());
                    mRep.Update(x);
                    mRep.Save();
                }
            }
        }