public ActionResult AddJurisdiction(JurisdictionListView jurisdictionView)
        {
            if (jurisdictionView == null)
            {
                throw new ArgumentNullException(nameof(jurisdictionView));
            }

            if (!ModelState.IsValid)
            {
                var jurisdictionModel = this.generalService.GetJurisdictionView(jurisdictionView, string.Empty);
                return(this.PartialView("AddJurisdiction", jurisdictionModel));
            }


            var jurisdictionInfo = this.generalService.ProcessJurisdictionInfo(jurisdictionView);

            if (!string.IsNullOrEmpty(jurisdictionInfo))
            {
                ModelState.AddModelError("", jurisdictionInfo);
                var jurisdictionModel = this.generalService.GetJurisdictionView(jurisdictionView, "");
                return(this.PartialView("AddJurisdiction", jurisdictionModel));
            }

            var returnMessage = string.Format("Jurisdiction Saved");

            var jurisdictionList = this.generalService.GetJurisdictionView(jurisdictionView, returnMessage);

            return(this.PartialView("AddJurisdiction", jurisdictionList));
        }
        public ActionResult EditJurisdiction(JurisdictionListView jurisdictionView)
        {
            if (jurisdictionView == null)
            {
                throw new ArgumentNullException("jurisdictionView");
            }

            if (!ModelState.IsValid)
            {
                var JurisdictionModel = this.generalService.GetJurisdictionView(jurisdictionView, string.Empty);

                return(this.View("EditJurisdiction", JurisdictionModel));
            }

            var jurisdictionEdit = this.generalService.UpdateJurisdictionInfo(jurisdictionView);

            if (!string.IsNullOrEmpty(jurisdictionEdit))
            {
                ModelState.AddModelError("", jurisdictionEdit);
                var JurisdictionModel = this.generalService.GetJurisdictionView(jurisdictionView, "");
                return(View("EditJurisdiction", JurisdictionModel));
            }

            var returnMessage = string.Format("Jurisdiction Updated ");

            return(this.RedirectToAction("Jurisdiction",
                                         new { message = returnMessage }));
        }
Пример #3
0
        /// <summary>
        /// Creates the jurisdiction view.
        /// </summary>
        /// <param name="jurisdictionView">The jurisdiction view.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">jurisdictionView</exception>
        public IJurisdictionListView CreateJurisdictionView(IJurisdiction jurisdictionListView)
        {
            if (jurisdictionListView == null)
            {
                throw new ArgumentNullException(nameof(jurisdictionListView));
            }
            var view = new JurisdictionListView
            {
                ProcessingMessage = "",

                JurisdictionId   = jurisdictionListView.JurisdictionId,
                JurisdictionName = jurisdictionListView.JurisdictionName
            };

            return(view);
        }
Пример #4
0
        public IJurisdictionListView CreateJurisdictionListView(int selectedId, string selectedDescription, IList <IJurisdiction> jurisdcitionCollection, string message)
        {
            if (jurisdcitionCollection == null)
            {
                throw new ArgumentNullException(nameof(jurisdcitionCollection));
            }

            var returnView = new JurisdictionListView
            {
                JurisdictionCollection = jurisdcitionCollection,
                ProcessingMessage      = message,
                SelectedDescription    = selectedDescription
            };

            return(returnView);
        }