public async Task<ActionResult> Index(IndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Areas = await GetAreas();

                return View(model);
            }

            var criteria = new AdvancedSearchCriteria
            {
                ConsentValidFromStart = model.ConsentValidFromStart.AsDateTime(),
                ConsentValidFromEnd = model.ConsentValidFromEnd.AsDateTime(),
                ConsentValidToStart = model.ConsentValidToStart.AsDateTime(),
                ConsentValidToEnd = model.ConsentValidToEnd.AsDateTime(),
                EwcCode = model.EwcCode,
                ImportCountryName = model.ImportCountryName,
                ImporterName = model.ImporterName,
                LocalAreaId = model.LocalAreaId,
                ProducerName = model.ProducerName,
                BaselOecdCode = model.BaselOecdCode,
                EntryPointName = model.EntryPointName,
                ExitPointName = model.ExitPointName,
                ExporterName = model.ExporterName,
                FacilityName = model.FacilityName,
                NotificationReceivedStart = model.NotificationReceivedStart.AsDateTime(),
                NotificationReceivedEnd = model.NotificationReceivedEnd.AsDateTime(),
                ImportNotificationStatus = model.GetImportNotificationStatus(),
                NotificationStatus = model.GetExportNotificationStatus(),
                TradeDirection = model.SelectedTradeDirection,
                NotificationType = model.SelectedNotificationType,
                OperationCodes = model.SelectedOperationCodes,
                IsInterim = model.IsInterim,
                ExportCountryName = model.ExportCountryName
            };

            if (model.BaselOecdCodeNotListed)
            {
                criteria.BaselOecdCodeNotListed = true;
            }

            return RedirectToAction("Results", criteria.ToRouteValueDictionary());
        }
Esempio n. 2
0
        public async Task <ActionResult> Index(IndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Areas = await GetAreas();

                return(View(model));
            }

            var criteria = new AdvancedSearchCriteria
            {
                ConsentValidFromStart = model.ConsentValidFromStart.AsDateTime(),
                ConsentValidFromEnd   = model.ConsentValidFromEnd.AsDateTime(),
                ConsentValidToStart   = model.ConsentValidToStart.AsDateTime(),
                ConsentValidToEnd     = model.ConsentValidToEnd.AsDateTime(),
                EwcCode                   = model.EwcCode,
                ImportCountryName         = model.ImportCountryName,
                ImporterName              = model.ImporterName,
                LocalAreaId               = model.LocalAreaId,
                ProducerName              = model.ProducerName,
                BaselOecdCode             = model.BaselOecdCode,
                EntryPointName            = model.EntryPointName,
                ExitPointName             = model.ExitPointName,
                ExporterName              = model.ExporterName,
                FacilityName              = model.FacilityName,
                NotificationReceivedStart = model.NotificationReceivedStart.AsDateTime(),
                NotificationReceivedEnd   = model.NotificationReceivedEnd.AsDateTime(),
                ImportNotificationStatus  = model.GetImportNotificationStatus(),
                NotificationStatus        = model.GetExportNotificationStatus(),
                TradeDirection            = model.SelectedTradeDirection,
                NotificationType          = model.SelectedNotificationType,
                OperationCodes            = model.SelectedOperationCodes,
                IsInterim                 = model.IsInterim,
                ExportCountryName         = model.ExportCountryName
            };

            if (model.BaselOecdCodeNotListed)
            {
                criteria.BaselOecdCodeNotListed = true;
            }

            return(RedirectToAction("Results", criteria.ToRouteValueDictionary()));
        }
Esempio n. 3
0
        public void CanParseImportStatus(ImportNotificationStatus status)
        {
            model.SelectedNotificationStatusId = (int)status + 500;

            Assert.Equal(status, model.GetImportNotificationStatus());
        }