Beispiel #1
0
        // GET: Home
        public ActionResult Index()
        {
            TrainingProductViewModel vm = new TrainingProductViewModel();

            vm.HandleRequest();
            return(View(vm));
        }
Beispiel #2
0
        public ActionResult Index(TrainingProductViewModel viewModel)
        {
            viewModel.HandleRequest();
            ModelState.Clear();

            return(View(viewModel));
        }
Beispiel #3
0
        public ActionResult Index()
        {
            var tgr = new TrainingProductViewModel();

            tgr.HandleRequest();
            return(View(tgr));
        }
        private TrainingProductViewModel Get()
        {
            var vm = new TrainingProductViewModel();

            vm.Products = _service.Get();
            return(vm);
        }
Beispiel #5
0
        public ActionResult Index(TrainingProductViewModel vm)
        {
            vm.IsValid = ModelState.IsValid;
            vm.HandleRequest();

            if (vm.IsValid)
            {
                ModelState.Clear();
            }
            return(View(vm));
        }
Beispiel #6
0
        public ActionResult Index(TrainingProductViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }

            var handler = new TrainingProductViewModelManager(
                vm, new TrainingProductService());
            var newVm = handler.HandleRequest();

            //ModelState.Clear();

            return(View(newVm));
        }
        public ActionResult Index(TrainingProductViewModel vm)
        {
            vm.IsValid = ModelState.IsValid;
            vm.HandleRequest();

            if (vm.IsValid)
            {
                ModelState.Clear();
            }
            else
            {
                vm.ValidationErrors.ForEach(_ =>
                                            ModelState.AddModelError(_.Key, _.Value));
            }
            return(View(vm));
        }
Beispiel #8
0
 public ActionResult Index(TrainingProductViewModel vm)
 {
     vm.IsValid = ModelState.IsValid;
     vm.HandleRequest();
     if (vm.IsValid)
     {
         ModelState.Clear();
     }
     else
     {
         foreach (KeyValuePair <string, string> item in vm.ValidationErrors)
         {
             ModelState.AddModelError(item.Key, item.Value);
         }
     }
     return(View(vm));
 }
Beispiel #9
0
 public ActionResult Index(TrainingProductViewModel vm)
 {
     vm.IsValid = ModelState.IsValid;
     vm.HandleRequest();
     ModelState["Mode"].Value = new ValueProviderResult(vm.Mode, null, System.Globalization.CultureInfo.CurrentCulture);
     if (vm.IsValid)
     {
         ModelState.Clear();
     }
     else
     {
         foreach (var item in vm.ValidationErrors)
         {
             ModelState.AddModelError(item.Key, item.Value);
         }
     }
     return(View(vm));
 }
        public ActionResult Index(TrainingProductViewModel vm)
        {
            vm.IsValid = ModelState.IsValid;
            vm.HandleRequest();

            if (vm.IsValid)
            {
                // NOTE: Must clear the model state in order to bind
                //       the @Html helpers to the new model values
                ModelState.Clear();
            }
            else
            {
                foreach (KeyValuePair <string, string> item in vm.ValidationErrors)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
            }

            return(View(vm));
        }
Beispiel #11
0
 public ActionResult Index(TrainingProductViewModel tgr)
 {
     tgr.HandleRequest();
     ModelState.Clear();
     return(View(tgr));
 }
 public TrainingProductViewModelManager(TrainingProductViewModel vm, TrainingProductService service)
 {
     _vm      = vm;
     _service = service;
 }