public static List <GithubProfileModel> FromDbToModelGithubprofilesList(List <GithubProfile> dbProfile) { List <GithubProfileModel> allProfiles = new List <GithubProfileModel>(); foreach (var profile in dbProfile) { GithubProfileModel temp = FromDbToModelForGithubProfileModel(profile); allProfiles.Add(temp); } return(allProfiles); }
// Get a Github profile by id public GithubProfileModel GetAGithubProfile(int id) { GithubProfile dbProfile = monitoringContext.GithubProfile.Find(id); if (dbProfile == null) { GithubProfileModel nullModel = new GithubProfileModel(); nullModel = null; return(nullModel); } else { return(Helper.FromDbToModelForGithubProfileModel(dbProfile)); } }
public static GithubProfileModel FromDbToModelForGithubProfileModel(GithubProfile dbGithubProfile) { GithubProfileModel profileModel = new GithubProfileModel(); profileModel.UserName = dbGithubProfile.UserName; profileModel.Url = dbGithubProfile.Url; profileModel.Company = dbGithubProfile.Company; profileModel.Name = dbGithubProfile.Name; profileModel.Bio = dbGithubProfile.Bio; profileModel.Location = dbGithubProfile.Location; profileModel.Email = dbGithubProfile.Email; profileModel.BlogOrWebsite = dbGithubProfile.BlogOrWebsite; profileModel.StarsCount = dbGithubProfile.StarsCount; profileModel.LastUpdate = dbGithubProfile.LastUpdate; return(profileModel); }