Esempio n. 1
0
 public void Add(Event e)
 {
     if (e.Type == TypesOfEvents.Birthday)
     {
         Birthday birthday = new Birthday()
         {
             Title = e.Title,
             Date = e.Date,
             Important = e.Important
         };
         context.Birthdays.Add(birthday);
     }
     else if (e.Type == TypesOfEvents.Nameday)
     {
         Nameday nameday = new Nameday()
         {
             Title = e.Title,
             Date = e.Date,
             Important = e.Important
         };
         context.Namedays.Add(nameday);
     }
     else
     {
         Other other = new Other()
         {
             Title = e.Title,
             Date = e.Date,
             Important = e.Important
         };
         context.Others.Add(other);
     }
     context.SaveChanges();
 }
Esempio n. 2
0
 public void Dodaj()
 {
     var context = new EFContext();
     Birthday birth = new Birthday();
     birth.Date = DateTime.Now;
     birth.Important = false;
     birth.Title = "Test";
     context.Birthdays.Add(birth);
     context.SaveChanges();
 }