Example #1
0
        public async Task Update(HoursOfOperation hours, HoursOfOperationUpdate update)
        {
            hours.Days = update.Days.Select(d => HoursOfOperationDay.Create(
                                                d.Day,
                                                d.Open,
                                                d.Open,
                                                d.Enabled
                                                )).ToList();

            await repo.Update(hours);
        }
Example #2
0
        public static HoursOfOperation Create(Guid userId)
        {
            var days = new List <HoursOfOperationDay>();

            // Default to Mon - Fri 8AM to 5PM
            for (int d = 1; d <= 6; d++)
            {
                days.Add(
                    HoursOfOperationDay.Create(
                        d,
                        8 * 60,
                        17 * 60
                        )
                    );
            }

            return(new HoursOfOperation()
            {
                Id = Guid.NewGuid(),
                UserId = userId,
                Days = days
            });
        }