Exemplo n.º 1
0
        internal static List <Suggestion> GetCurrentSuggestion(int userId)
        {
            List <Suggestion> results;

            DateTime timeFrom = DateTime.Now.Date;
            DateTime timeTo   = DateTime.Now;

            using (OstrichTimeEntities en = new OstrichTimeEntities())
            {
                results = en.Suggestions.Where(tl => tl.UserId == userId &&
                                               timeFrom <= tl.TimeStamp &&
                                               timeTo >= tl.TimeStamp).ToList();
            }

            return(results);
        }
Exemplo n.º 2
0
        internal static Suggestion InsertSuggestion(int userId, DateTime time, string label)
        {
            var Suggestion = new Suggestion()
            {
                UserId    = userId,
                TimeStamp = time,
                Label     = label
            };

            using (OstrichTimeEntities en = new OstrichTimeEntities())
            {
                en.Suggestions.AddObject(Suggestion);

                en.SaveChanges();
            }

            return(Suggestion);
        }