예제 #1
0
        public void UpdateOrAdd(string name, int karma)
        {
            string idName = name.ToLower();

            if (Exists(name))
            {
                RefreshLocalEntriesFor(idName);
                _entries[idName].Karma = karma;
                _context.Update(_entries[idName]);
            }
            else
            {
                _entries[idName] = new Entry(name, karma);
                _context.Add(_entries[idName]);
            }
            _context.SaveChanges();
        }
예제 #2
0
 public void Add(Reason reason)
 {
     _context.Reasons.Add(reason);
     _context.SaveChanges();
 }