public void ChangeUserStats(UserProfileStats u) { try { ChangeUserStatsValues(u); } catch (NullReferenceException) { context.UserStats.Add(u); } context.SaveChanges(); }
public void ChangeUserStatsValues(UserProfileStats u) { context.UserStats.Find((long)1).FirstName = u.FirstName; context.UserStats.Find((long)1).LastName = u.LastName; context.UserStats.Find((long)1).Age = u.Age; context.UserStats.Find((long)1).EnjoysSportsRating = u.EnjoysSportsRating; context.UserStats.Find((long)1).FrugalityRating = u.FrugalityRating; context.UserStats.Find((long)1).PhysicallyActiveRating = u.PhysicallyActiveRating; context.UserStats.Find((long)1).DesireForKidsRating = u.DesireForKidsRating; context.UserStats.Find((long)1).SenseOfHumorRating = u.SenseOfHumorRating; context.UserStats.Find((long)1).DrivenRating = u.DrivenRating; context.UserStats.Find((long)1).AdditionalDetails = u.AdditionalDetails; }
public UserProfileStats GetUserStats() { UserProfileStats tempUserDatabaseStats; try { tempUserDatabaseStats = context.UserStats.Find((long)1); } catch (NullReferenceException) { tempUserDatabaseStats = new UserProfileStats( "N/A", "N/A", 0, 0, 0, 0, 0, 0, 0, "N/A"); } if (tempUserDatabaseStats == null) { tempUserDatabaseStats = new UserProfileStats( "N/A", "N/A", 0, 0, 0, 0, 0, 0, 0, "N/A"); } return(tempUserDatabaseStats); }
public void AddUserStats(UserProfileStats u) { context.UserStats.Add(u); context.SaveChanges(); }