Exemplo n.º 1
0
        public ActionResult Index()
        {
            FeedingReminderAccess feedingReminderAccess = new FeedingReminderAccess();

            IEnumerable <FeedingReminder> allReminders = feedingReminderAccess.GetFeedingReminders();

            FeedingReminder[] reminders = allReminders.Cast <FeedingReminder>().ToArray();

            List <int> ids = filterIds(reminders);

            var feedings = db.Feedings.Include(f => f.AnimalGroups).Include(f => f.Employees).Include(f => f.FoodProducts).Where(f => ids.Contains(f.FeedingId));

            return(View(feedings.ToList()));
        }
Exemplo n.º 2
0
        public ActionResult MarkAsShown(int?id)
        {
            FeedingReminderAccess feedingReminderAccess = new FeedingReminderAccess();

            IEnumerable <FeedingReminder> allReminders = feedingReminderAccess.GetFeedingReminders();

            FeedingReminder[] reminders = allReminders.Cast <FeedingReminder>().ToArray();

            for (int i = 0; i < reminders.Length; i++)
            {
                if (reminders[i].FeedingId == id)
                {
                    reminders[i].WasShown = 1;
                    feedingReminderAccess.Update(reminders[i].Id, reminders[i]);
                }
            }

            List <int> ids = filterIds(reminders);

            var feedings = db.Feedings.Include(f => f.AnimalGroups).Include(f => f.Employees).Include(f => f.FoodProducts).Where(f => ids.Contains(f.FeedingId));

            return(View(feedings.ToList()));
        }