Ejemplo n.º 1
0
        public MoviePlan CreateMoviePlanForWeek(DateTime startDate)
        {
            DateTime sundayOfThatWeek = startDate.WeekStartDate();

            if (sundayOfThatWeek > DateTime.Now.WeekStartDate())
            {
                throw new BusinessValidationException("Cant create Movie Plan for future weeks");
            }

            MoviePlan result = moviePlans.FirstOrDefault(mp => mp.StartDate == sundayOfThatWeek);
            if (result == null)
            {
                result = new MoviePlan(sundayOfThatWeek);
                moviePlans.Add(result);
            }
            return result;
        }
Ejemplo n.º 2
0
 public MoviePlan GetMoviePlanForWeek(DateTime startDate)
 {
     DateTime sundayOfThatWeek = startDate.WeekStartDate();
     return moviePlans.FirstOrDefault(mp => mp.StartDate == sundayOfThatWeek);
 }
Ejemplo n.º 3
0
 public MoviePlan(DateTime startDate)
 {
     this.StartDate = startDate.WeekStartDate();
     this.Slots = new List<Slot>();
     foreach (TimeSlot eachSlot in Enum.GetValues(typeof(TimeSlot)))
     {
         foreach (DayOfWeek eachDay in Enum.GetValues(typeof(DayOfWeek)))
         {
             this.Slots.Add(new Slot(eachDay, eachSlot));
         }
     }
 }