public void AddEvent(string EventNam) { DataBaseECont.EventBase.Add(new EventBase { EventName = EventNam }); DataBaseECont.SaveChanges(); }
public bool AddEventsFromEventCreator(List <EventDataCreator> Inlist) { try { DataBaseECont.Database.Connection.Open(); DataBaseECont.EventBase.Add(new EventBase { EventName = Inlist.First().EventName, EventTimeTable = CollectionFromEventDateCreator(Inlist) }); //ВЫбрать между этим или Foreach ниже foreach (EventDataCreator DT in Inlist) { DataBaseECont.EventTimeTable.Add(new EventTimeTable { EventDateTime = DT.EventDate, EventID = DataBaseECont.EventBase.Local.Last().EventID, UserID = (short)DataBaseECont.GetNowUserID(), EverywhatRemind = DT.RemindEvery }); } DataBaseECont.SaveChanges(); DataBaseECont.Database.Connection.Close(); return(true); } catch { return(false); } }
public bool AddRemindsFromRemindCreator(List <RemindDataCreator> InList, int InID) { try { DataBaseECont.Database.Connection.Open(); foreach (RemindDataCreator DT in InList) { DataBaseECont.EventRemindTable.Add(new EventRemindTable { EventID = InID, DateUntilRemind = DT.RemindUntil, UserID = (short)DataBaseECont.GetNowUserID(), TypeOfRemind = DT.HowToRemind, //TODO }); } DataBaseECont.SaveChanges(); DataBaseECont.Database.Connection.Close(); return(true); } catch { return(false); } }