Exemplo n.º 1
0
        private List<CalEventModel> GetEventsFromDB()
        {
            // this is random object for picking random color for each Stay
            var Random1 = new Random();

            List<CalEventModel> eventList = new List<CalEventModel>();
            if (ModelState.IsValid)
            {
                List<Stay> stayList = db.Stays.ToList();
                foreach (var stay in stayList)
                {
                    DateTime startDateDT = stay.StartDate.GetValueOrDefault(DateTime.Now);
                    DateTime endDateDT = stay.EndDate.GetValueOrDefault(DateTime.Now).AddDays(1);
                    CalEventModel newEvent = new CalEventModel
                    {
                        id = "1",
                        title = stay.Dog.FirstName, //"Event 1",
                        start = startDateDT.ToString("s"), //DateTime.Now.AddDays(1).ToString("s"),
                        end = endDateDT.ToString("s"), //DateTime.Now.AddDays(1).ToString("s"),
                        allDay = true
                    };

                    newEvent.color = colorArray[Random1.Next(0, colorArray.Length)];
                    eventList.Add(newEvent);
                }
            }
            return eventList;
        }
Exemplo n.º 2
0
        private List<CalEventModel> GetEvents2()
        {
            List<CalEventModel> eventList = new List<CalEventModel>();

            CalEventModel newEvent = new CalEventModel
            {
                id = "1",
                title = "Event 1",
                start = DateTime.Now.AddDays(1).ToString("s"),
                end = DateTime.Now.AddDays(1).ToString("s"),
                allDay = false
            };

            eventList.Add(newEvent);

            newEvent = new CalEventModel
            {
                id = "1",
                title = "Event 3",
                start = DateTime.Now.AddDays(2).ToString("s"),
                end = DateTime.Now.AddDays(3).ToString("s"),
                allDay = false
            };

            eventList.Add(newEvent);

            return eventList;
        }