コード例 #1
0
        public Day Update(UpdateDayCommand command)
        {
            var Day = _repository.Get(command.Id);

            Day.Update(command.DayOfWeek, command.Active, command.Reserved);
            _repository.Update(Day);

            if (Commit())
            {
                return(Day);
            }

            return(null);
        }
コード例 #2
0
        private string addOrUpdateCurrentDay(string date)
        {
            date = Md5Hashing.CreateMD5(date);
            var day = _dayRepository.Get(date);

            if (day == null)
            {
                _dayRepository.Add(new WholeDay(date));
            }

            return(date);
        }
コード例 #3
0
    public Handlers(IDayRepository repository)
    {
        _repository = repository;

        Register <ScheduleDay>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(new DoctorId(c.DoctorId), c.Date));
            day.Schedule(new DoctorId(c.DoctorId), c.Date, c.Slots, Guid.NewGuid);
            await _repository.Save(day, m);
        });

        Register <ScheduleSlot>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(new DoctorId(c.DoctorId), c.Date));
            day.ScheduleSlot(c.SlotId, c.StartTime, c.Duration);
            await _repository.Save(day, m);
        });

        Register <BookSlot>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(c.DayId));
            day.BookSlot(new SlotId(c.SlotId), new PatientId(c.PatientId));
            await _repository.Save(day, m);
        });

        Register <CancelSlotBooking>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(c.DayId));
            day.CancelSlotBooking(c.SlotId, c.Reason);
            await _repository.Save(day, m);
        });

        Register <CancelDaySchedule>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(c.DayId));
            day.Cancel();
            await _repository.Save(day, m);
        });

        Register <ArchiveDaySchedule>(async(c, m) =>
        {
            var day = await _repository.Get(new DayId(c.DayId));
            day.Archive();
            await _repository.Save(day, m);
        });
    }