Beispiel #1
0
 public void UpdateTemplateSchedule(TemplateSchedule templateSchedule, List <TemplateShift> deletedShifts)
 {
     if (ValidateTemplateSchedule(templateSchedule))
     {
         using (TransactionScope scope = new TransactionScope())
         {
             _templateScheduleRepository.UpdateTemplateSchedule(templateSchedule);
             _templateShiftController.AddTemplateShiftsFromTemplateSchedule(templateSchedule.Id, templateSchedule.TemplateShifts);
             deletedShifts.ForEach(x => _templateShiftController.DeleteTemplateShift(x));
             scope.Complete();
         }
     }
     else
     {
         throw new ArgumentException();
     }
 }
Beispiel #2
0
        public void UpdateTemplateScheduleTest()
        {
            TemplateSchedule templateSchedule = _templateScheduleRepository.GetAllTemplateSchedules().ToList()[0];

            byte[] rowVersion1 = templateSchedule.RowVersion;
            templateSchedule.NoOfWeeks = 2;

            _templateScheduleRepository.UpdateTemplateSchedule(templateSchedule);
            templateSchedule = _templateScheduleRepository.GetAllTemplateSchedules().ToList()[0];
            byte[] rowVersion2 = templateSchedule.RowVersion;

            Assert.AreEqual(2, templateSchedule.NoOfWeeks);
            Assert.AreNotEqual(rowVersion1, rowVersion2);
        }