Пример #1
0
 public bool CreateColoredEvent(ColoredEvent instance)
 {
     if (instance.id == 0)
     {
         Db.ColoredEvents.Add(instance);
         Db.SaveChanges();
         return(true);
     }
     return(false);
 }
Пример #2
0
        public bool UpdateColoredEvent(ColoredEvent instance)
        {
            var cache = Db.ColoredEvents.FirstOrDefault(o => o.id == instance.id);

            if (cache != null)
            {
                Db.Entry(cache).CurrentValues.SetValues(instance);
                Db.SaveChanges();
                return(true);
            }
            return(false);
        }