Example #1
0
        protected override BookingStepConfig DoPostPutDto(Client currentClient, BookingStepConfigDTO dto, BookingStepConfig entity, string path, object param)
        {
            if (entity == null)
            {
                entity = new BookingStepConfig();
            }
            GetMapper.Map <BookingStepConfigDTO, BookingStepConfig>(dto, entity);
            if (dto.BookingSteps != null)
            {
                BookingStepRepository.DeleteRange(entity.BookingSteps.Where(d => !dto.BookingSteps.Any(x => x.Id == d.Id)));
                dto.BookingSteps.ForEach(bookingStep =>
                {
                    if (entity.BookingSteps.Count != 0 && bookingStep.Id != 0 &&
                        entity.BookingSteps.Find(p => p.Id == bookingStep.Id) != null)
                    {
                        return;
                    }
                    BookingStep toAdd = BookingStepService.PreProcessDTOPostPut(validationDictionnary, dto.HomeId, bookingStep, currentClient, path);

                    if (toAdd != null)
                    {
                        entity.BookingSteps.Add(toAdd);
                    }
                });
            }
            return(entity);
        }
Example #2
0
        protected override void DoPut(Client currentClient, BookingStepBooking entity, object param)
        {
            var origCopy = BookingStepBookingRepository.GetBookingStepBookingById(entity.Id, currentClient.Id);

            if (origCopy.BookingStepConfig.Id != entity.BookingStepConfig.Id)
            {
                entity.CurrentStep = BookingStepRepository.GetFirstBookingStep(entity.BookingStepConfig.Id, currentClient.Id);
            }
            if (origCopy.CurrentStep.Id != entity.CurrentStep.Id)
            {
                entity.MailSent = 0;
                ValidateBooking(entity);
                entity.DateCurrentStepChanged = DateTime.UtcNow;
            }
        }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new BookingStepRepository(ctx);
 }
Example #4
0
 protected override void DoPost(Client currentClient, BookingStepBooking entity, object param)
 {
     entity.CurrentStep = BookingStepRepository.GetFirstBookingStep(entity.BookingStepConfig.Id, currentClient.Id);
     ValidateBooking(entity);
 }
Example #5
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new BookingStepRepository(ctx);
 }