Example #1
0
        public async Task Update(Appointment appointment, AppointmentUpdate update)
        {
            appointment.ServiceId = update.ServiceId;
            appointment.ClientId  = update.ClientId;
            appointment.Price     = update.Price;
            appointment.Notes     = update.Notes;

            appointment.Blocks = update.Blocks.Select(b => AppointmentBlock.Create(
                                                          appointment.Id,
                                                          b.Start,
                                                          b.End
                                                          )).ToList();

            await repo.Update(appointment);
        }
Example #2
0
        public async Task <Appointment> Create(AppointmentCreate create, User user)
        {
            var appointment = Appointment.Create(
                user.Id,
                create.ServiceId,
                create.ClientId,
                create.Price,
                create.Notes
                );

            appointment.Blocks = create.Blocks.Select(b => AppointmentBlock.Create(
                                                          appointment.Id,
                                                          b.Start,
                                                          b.End
                                                          )).ToList();

            await repo.Add(appointment);

            return(appointment);
        }