Exemple #1
0
        static void Main(string[] args)
        {
            var cc = ModelCreator.CreateNewModel();

            var context = new MonitoringEntities();

            CRUD crud = new CRUD();

            foreach (var item in crud.GetJobTitlesAndCompany())
            {
                Console.WriteLine(item);
            }

            if (crud.DeleteGitHubProfileByID(12))
            {
                Console.WriteLine("Succsess!!!");
            }
            else
            {
                Console.WriteLine("Faild");
            }

            if (crud.UpdateGitHubProfileUserName("sebas252", "Narlennnnnnnnbbbbbbbbbbbnn"))
            {
                Console.WriteLine("Succsess2!!!");
            }
            else
            {
                Console.WriteLine("Faild2");
            }
        }
Exemple #2
0
        public bool DeleteGitHubProfileByID(int Id)
        {
            MonitoringEntities monitoring = new MonitoringEntities();
            GithubProfile      profile    = monitoring.GithubProfiles.FirstOrDefault(x => x.Id == Id);

            if (profile is null)
            {
                return(false);
            }

            monitoring.GithubProfiles.Remove(profile);
            monitoring.SaveChanges();
            return(true);
        }
Exemple #3
0
        public bool UpdateGitHubProfileUserName(string userName, string newName)
        {
            MonitoringEntities monitoring = new MonitoringEntities();
            GithubProfile      profile    = monitoring.GithubProfiles.Select(x => x).FirstOrDefault(x => x.UserName == userName);

            if (profile is null)
            {
                return(false);
            }

            profile.Name = newName;
            monitoring.SaveChanges();
            return(true);
        }
Exemple #4
0
        public static List <dynamic> CreateNewModel()
        {
            MonitoringEntities monitoring = new MonitoringEntities();
            var newModel = new List <dynamic>();

            foreach (var item in monitoring.GithubLinkedinCrossTables)
            {
                if (monitoring.GithubProfiles.Select(x => x.Id).Contains(item.GithubUserId))
                {
                    newModel.Add(new { Id           = item.Id, GitUserName = monitoring.GithubProfiles.FirstOrDefault(x => x.Id == item.GithubUserId).UserName,
                                       LinkUserName = monitoring.LinkedinProfiles.FirstOrDefault(x => x.Id == item.LinkedinUserId).Username });
                }
            }

            return(newModel);
        }