コード例 #1
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);
        }
コード例 #2
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);
        }