private WorkTimeSheetViewModel MapToViewModel(WorkTimeSheet workTimeSheet)
        {
            WorkTimeSheetViewModel workTimeSheetViewModel = new WorkTimeSheetViewModel();

            workTimeSheetViewModel.Day = workTimeSheet.Day.ToString();
            if (!workTimeSheet.IsOpen)
            {
                workTimeSheetViewModel.Status = "Close";
                return(workTimeSheetViewModel);
            }
            workTimeSheetViewModel.Status             = "Open";
            workTimeSheetViewModel.WorkTimeViewModels = new List <WorkTimeViewModel>();
            foreach (var item in workTimeSheet.WorkTimes)
            {
                workTimeSheetViewModel.WorkTimeViewModels.Add(MapToViewMode(item));
            }

            return(workTimeSheetViewModel);
        }
        private static MealType?GetMealType(this DateTime dateTime, WorkTimeSheet workTimeSheet, bool checkOneDayBefor = false)
        {
            foreach (var item in workTimeSheet?.WorkTimes)
            {
                DateTime fromTime = item.StartTime.ToDateTime(dateTime);
                DateTime toTime   = item.EndTime.ToDateTime(dateTime);
                if (checkOneDayBefor && fromTime > toTime)
                {
                    fromTime = fromTime.AddDays(-1);
                }


                if (dateTime >= fromTime && dateTime <= toTime)
                {
                    return(item.MealType);
                }
            }

            return(null);
        }
        public List <WorkTimeSheet> GetMockData()
        {
            List <WorkTimeSheet> workTimeSheets = new List <WorkTimeSheet>();

            WorkTimeSheet monday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Monday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            monday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            monday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            monday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            monday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 2300, MealType = Model.Enum.MealType.Dinner
            });

            WorkTimeSheet tuesday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Tuesday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            tuesday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            tuesday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            tuesday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            tuesday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 2300, MealType = Model.Enum.MealType.Dinner
            });


            WorkTimeSheet wednesday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Wednesday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            wednesday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            wednesday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            wednesday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            wednesday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 2300, MealType = Model.Enum.MealType.Dinner
            });

            WorkTimeSheet thursday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Thursday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            thursday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            thursday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            thursday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            thursday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 2300, MealType = Model.Enum.MealType.Dinner
            });

            WorkTimeSheet friday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Friday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            friday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            friday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            friday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            friday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 2300, MealType = Model.Enum.MealType.Dinner
            });

            WorkTimeSheet saturday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Saturday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            saturday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            saturday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            saturday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            saturday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 200, MealType = Model.Enum.MealType.Dinner
            });


            WorkTimeSheet sunday = new WorkTimeSheet
            {
                Day       = DayOfWeek.Sunday,
                IsOpen    = true,
                WorkTimes = new List <WorkTime>()
            };

            sunday.WorkTimes.Add(new WorkTime {
                StartTime = 600, EndTime = 1100, MealType = Model.Enum.MealType.Breakfast
            });
            sunday.WorkTimes.Add(new WorkTime {
                StartTime = 1200, EndTime = 1500, MealType = Model.Enum.MealType.Lunch
            });
            sunday.WorkTimes.Add(new WorkTime {
                StartTime = 1700, EndTime = 1900, MealType = Model.Enum.MealType.Lunch
            });
            sunday.WorkTimes.Add(new WorkTime {
                StartTime = 2000, EndTime = 200, MealType = Model.Enum.MealType.Lunch
            });


            workTimeSheets.Add(monday);
            workTimeSheets.Add(tuesday);
            workTimeSheets.Add(wednesday);
            workTimeSheets.Add(thursday);
            workTimeSheets.Add(friday);
            workTimeSheets.Add(saturday);
            workTimeSheets.Add(sunday);

            return(workTimeSheets);
        }