コード例 #1
0
        public ActionResult Index(ProtocolsInputModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.Update(this.ConfigurationRepository);
                    TempData["Message"] = Resources.ProtocolController.UpdateSuccessful;
                    return RedirectToAction("Index");
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", Resources.ProtocolController.ErrorUpdatingProtocols);
                }
            }

            var vm = new ProtocolsViewModel(ConfigurationRepository);
            return View("Index", vm);
        }
コード例 #2
0
        public ActionResult Index(ProtocolsInputModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.Update(this.ConfigurationRepository);
                    TempData["Message"] = "Update Successful";
                    return(RedirectToAction("Index"));
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", "Error updating protocols.");
                }
            }

            var vm = new ProtocolsViewModel(ConfigurationRepository);

            return(View("Index", vm));
        }