コード例 #1
0
        public Occasion Update(Occasion alteredEvent)
        {
            var occasion = applicationContext.Occasions.Attach(alteredEvent);

            occasion.State = EntityState.Modified;
            applicationContext.SaveChanges();
            return(alteredEvent);
        }
コード例 #2
0
        public Occasion Delete(int id)
        {
            Occasion occasion = applicationContext.Occasions.Find(id);

            if (occasion != null)
            {
                applicationContext.Occasions.Remove(occasion);
                applicationContext.SaveChanges();
            }
            return(occasion);
        }
コード例 #3
0
 public Occasion Add(Occasion Event)
 {
     applicationContext.Add(Event);
     applicationContext.SaveChanges();
     return(Event);
 }