Example #1
0
        private WhosOffDataModel ToModel(IEnumerable <IEnumerable <IEvent> > events)
        {
            var model = new WhosOffDataModel();

            model.title            = "Whos Off";
            model.updatedAtMessage = DateTime.Now.ToLongDateString();

            foreach (var cal in events)
            {
                foreach (var subItem in cal)
                {
                    var item = new WhosOffDataModel.Item()
                    {
                        StartDate = subItem.Start.Value,
                        EndDate   = subItem.End.Value,
                        DaysOff   = Math.Round((subItem.End.Value - subItem.Start.Value).TotalDays, 2),
                        Name      = subItem.Summary,
                    };

                    model.items.Add(item);
                }
            }

            return(model);
        }
Example #2
0
        private WhosOffDataModel ToModel(IEnumerable<IEnumerable<IEvent>> events)
        {
            var model = new WhosOffDataModel();
            model.title = "Whos Off";
            model.updatedAtMessage = DateTime.Now.ToLongDateString();

            foreach (var cal in events)
            {
                foreach (var subItem in cal)
                {
                    var item = new WhosOffDataModel.Item()
                    {
                        StartDate = subItem.Start.Value,
                        EndDate = subItem.End.Value,
                        DaysOff = Math.Round((subItem.End.Value - subItem.Start.Value).TotalDays, 2),
                        Name = subItem.Summary,
                    };

                    model.items.Add(item);
                }
            }

            return model;
        }