public void CreateBlocks(Scheduling scheduling, int totalBlock) { //create blocks for each scheduling(số lượng block dựa vào thời gian bắt đầu kết thúc) var startTime = scheduling.StartTime; for (int i = 0; i < totalBlock; i++) { Block block = scheduling.Adapt <Block>(); block.Id = Guid.Empty; block.StartTime = startTime; block.SchedulingId = scheduling.Id; _blockRepository.Add(block); startTime = startTime.Add(new TimeSpan(0, 30, 0)); } }