public static SessionsInMemory GetInstance()
 {
     if (SessionsInMemory.Instance == null)
     {
         SessionsInMemory.Instance = new SessionsInMemory();
     }
     return(SessionsInMemory.Instance);
 }
Esempio n. 2
0
 private SpeakerInMemory()
 {
     this.Speakers = new List <Speaker> {
         new Speaker
         {
             Id       = Guid.NewGuid(),
             Name     = "Filip Ekberg",
             Birthday = new DateTime(1990, 09, 30),
             Sessions = SessionsInMemory.GetInstance().Sessions
         }
     };
 }
        public bool Delete(Session t)
        {
            var sess = SessionsInMemory.GetInstance().Sessions.FirstOrDefault(session => session.Id == t.Id);

            if (sess == null)
            {
                return(false);
            }

            sess.Deleted = true;
            return(true);
        }
        public Session Update(Session t)
        {
            var session = SessionsInMemory.GetInstance().Sessions.FirstOrDefault(sess => sess.Id == t.Id);

            if (session == null)
            {
                return(null);
            }
            session.Abstract    = t.Abstract;
            session.Deleted     = t.Deleted;
            session.Length      = t.Length;
            session.ScheduledAt = t.ScheduledAt;
            session.SubmittedAt = t.SubmittedAt;
            session.Title       = t.Title;
            return(session);
        }
 public ICollection <Session> FindAllSessions()
 {
     return((ICollection <Session>)SessionsInMemory.GetInstance().Sessions);
 }
 public Session Create(Session t)
 {
     t.Id = new Guid();
     SessionsInMemory.GetInstance().Sessions.Append(t);
     return(t);
 }