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
        private void AddEvent()
        {
            Event newEvent = new Event()
            {
                Title = FormViewModel.Title,
                Date = FormViewModel.Date,
                Important = FormViewModel.Important,
                Type = FormViewModel.SelectedType
            };

            FacadeInstancy.Add(newEvent);
            FormViewModel.ClearForm();
        }