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); }
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); }