private async Task <SearchViewModel> InitSearchModel()
        {
            SearchViewModel model = new SearchViewModel();

            List <string> versions = new List <string>();
            List <string> statuses = new List <string>();
            List <string> users    = new List <string>();

            try
            {
                versions = await repository.GetVersionsAsync("PVINE");

                statuses = await repository.GetStatusesAsync();
            }
            catch (Exception ex)
            {
                error = String.Format("Exception: {0}", ex.Message);
                return(null);
            }

            var verList = new List <SelectListItem>();

            foreach (var version in versions)
            {
                verList.Add(new SelectListItem
                {
                    Value = version,
                    Text  = version
                });
            }
            model.Versions = verList;

            var statList = new List <SelectListItem>();

            foreach (var status in statuses)
            {
                statList.Add(new SelectListItem
                {
                    Value = status,
                    Text  = status
                });
            }
            model.Statuses = statList;

            return(model);
        }
        public async Task <ActionResult> Index(Cart cart)
        {
            Cart c = cart;

            ViewBag.Count = c.Issues.Count;

            List <string> versions = new List <string>();
            List <string> trType   = new List <string>();
            List <Tuple <string, string> > resolutions = new List <Tuple <string, string> >();

            try
            {
                versions = await jRepository.GetVersionsAsync("PVINE");

                trType = await jRepository.GetAvailableStatusesAsync(cart.Issues.First().Key);

                resolutions = await jRepository.GetResolutionsAsync();
            }
            catch (Exception ex)
            {
                var exc = ex.Message;
                return(RedirectToAction("Oops", "Error"));
            }

            TransactionSettingsViewModel settings = new TransactionSettingsViewModel();

            var verList = new List <SelectListItem>();

            foreach (var version in versions)
            {
                verList.Add(new SelectListItem
                {
                    Value = version,
                    Text  = version
                });
            }
            settings.Versions = verList;

            var typeList = new List <SelectListItem>();

            foreach (var type in trType)
            {
                typeList.Add(new SelectListItem
                {
                    Value = type,
                    Text  = type
                });
            }
            settings.Types = typeList;

            var resList = new List <SelectListItem>();

            foreach (var resolution in resolutions)
            {
                resList.Add(new SelectListItem
                {
                    Value = resolution.Item1,
                    Text  = resolution.Item2
                });
            }
            settings.Resolutions = resList;

            var locations = new List <SelectListItem>();

            locations.Add(new SelectListItem
            {
                Value = "QA",
                Text  = "QA"
            });
            locations.Add(new SelectListItem
            {
                Value = "Dev54",
                Text  = "Dev54"
            });
            locations.Add(new SelectListItem
            {
                Value = "Stage",
                Text  = "Stage"
            });
            locations.Add(new SelectListItem
            {
                Value = "Live",
                Text  = "Live"
            });
            settings.CodeLocations = locations;


            return(View(settings));
        }