Ejemplo n.º 1
0
        public ActionResult Search(SearchPacksViewModel searchPacksViewModel)
        {
            if (!this.ModelState.IsValid)
            {
                var errorList = this.ModelState.Values.SelectMany(x => x.Errors).ToList();
                return(this.Json(new { error = true, Error = errorList }));
            }

            var model = new SearchPacksResultsViewModel();

            IList <PackStore> packs = this.packStoreService.GetNonPulledPacks(
                searchPacksViewModel.SearchCriteria, searchPacksViewModel.JobId);

            if (packs.Count == 0)
            {
                return(this.Json(new { error = true, Error = "Could not find any packs for the serach criteria" }));
            }

            model.AddPacks(packs);

            return(this.Json(new
            {
                error = false,
                message = RenderRazorView.RenderRazorViewToString("_PullList", model, ControllerContext, ViewData, TempData)
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult GetAdditionalInfo(List <String> files, String path)
        {
            if (String.IsNullOrEmpty(path) || files == null || files.Count == 0)
            {
                return(this.Json
                           (new
                {
                    error = false,
                    message = RenderRazorView.RenderRazorViewToString("_AdditionalInfo", new AdditionalSetupViewModel(), ControllerContext, ViewData, TempData)
                }, JsonRequestBehavior.AllowGet));
            }

            var additionalFileInfo       = this.submitJobsService.GetAdditionalInfo(path, files);
            var additionalSetupViewModel = new AdditionalSetupViewModel(additionalFileInfo);

            return(this.Json(new
            {
                error = false,
                message = RenderRazorView.RenderRazorViewToString("_AdditionalInfo", additionalSetupViewModel, ControllerContext, ViewData, TempData)
            }, JsonRequestBehavior.AllowGet));
        }