Ejemplo n.º 1
0
        public ActionResult SelectPackageType(PackageTypeViewModel packageTypeViewModel)
        {
            try
            {
                var viewModel = _packageTypeService.GetById(packageTypeViewModel.cmbPackageType);

                if (viewModel == null)
                {
                    throw new Exception("Unable to find package type.");
                }

                return RedirectToAction("AddPackage", new {viewModel.cmbPackageType });
            }
            catch (ValidationException vex)
            {
                ModelState.AddErrors(vex);
                return View();
            }
            catch (Exception ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);

                return RedirectToAction("Error", "Error");
            }
        }
Ejemplo n.º 2
0
        public ActionResult SelectPackageType()
        {
            try
            {
                var packageTypes = _packageTypeService.GetPackageTypes();

                if (packageTypes == null)
                {
                    throw new Exception("Unable to find package types.");
                }

                ViewBag.cmbPackageType = new SelectList(packageTypes, "Key", "Value");

                var viewModel = new PackageTypeViewModel();

                return View(viewModel);
            }
            catch (Exception ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);

                return RedirectToAction("Error", "Error");
            }
        }