public static void InsertUserInfo(FormUserInfo userinfo, string channel, string id) { using (var db = new UserKeywords()) { var UserInfo = new UserInfo(); UserInfo.GitHubLogin = userinfo.GitHubUID; UserInfo.Email = userinfo.Email; UserInfo.channel = channel; UserInfo.userID = id; db.UserInfo.Add(UserInfo); db.SaveChanges(); } }
public static void UpdateUserInfo(FormUserInfo userinfo, string channel, string id) { using (var db = new UserKeywords()) { var UserInfo = new UserInfo(); UserInfo.GitHubLogin = userinfo.GitHubUID; UserInfo.Email = userinfo.Email; UserInfo.channel = channel; UserInfo.userID = id; db.UserInfo.Attach(UserInfo); db.Entry(UserInfo).State = EntityState.Modified; db.SaveChanges(); } }