public RegisterViewModel() { MoodEntry = App.MoodDatabase.GetMoodEntry(DateTime.Today); if (MoodEntry == null) { MoodEntry = new MoodEntry(); } LowerLimitDate = new DateTime(2018, 1, 1); HighLimitDate = DateTime.Today; }
public int SaveMoodEntry(MoodEntry entry) { lock (locker) { var existing = GetMoodEntry(entry.EntryDate); if (existing != null) { entry.MoodEntryID = existing.MoodEntryID; db.Update(entry); } else { db.Insert(entry); } } return(entry.MoodEntryID); }