public ActionResult AddIndustry(IndustryListView industryView)
        {
            if (industryView == null)
            {
                throw new ArgumentNullException(nameof(industryView));
            }

            if (!ModelState.IsValid)
            {
                var industryModel = this.generalService.GetIndustryView(industryView, string.Empty);
                return(this.PartialView("AddIndustry", industryModel));
            }

            var industryInfo = this.generalService.ProcessIndustryInfo(industryView);

            if (!string.IsNullOrEmpty(industryInfo))
            {
                ModelState.AddModelError("", industryInfo);
                var industryModel = this.generalService.GetIndustryView(industryView, "");

                return(PartialView("AddIndustry", industryModel));
            }
            var industrySave = "    Industry Saved";
            var industry     = this.generalService.GetIndustryView(industryView, industrySave);

            return(PartialView("AddIndustry", industry));
        }
        public ActionResult EditIndustry(IndustryListView industryView)
        {
            if (industryView == null)
            {
                throw new ArgumentNullException("industryView");
            }

            if (!ModelState.IsValid)
            {
                var incomeTypeModel = this.generalService.GetIndustryView(industryView, string.Empty);

                return(this.View("EditIndustry", industryView));
            }

            var industryEdit = this.generalService.UpdateIndustryInfo(industryView);

            if (!string.IsNullOrEmpty(industryEdit))
            {
                ModelState.AddModelError("", industryEdit);
                var industryModel = this.generalService.GetIndustryView(industryView, "");
                return(View("EditIndustry", industryModel));
            }

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

            return(this.RedirectToAction("Industry",
                                         new { message = returnMessage }));
        }
        /// <summary>
        /// Creates the industry view.
        /// </summary>
        /// <param name="industryView">The industry view.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">industryView</exception>
        public IIndustryListView CreateIndustryView(IIndustry industryView)
        {
            if (industryView == null)
            {
                throw new ArgumentNullException(nameof(industryView));
            }
            var view = new IndustryListView
            {
                ProcessingMessage = "",
                IndustryId        = industryView.IndustryId,
                IndustryName      = industryView.IndustryName,
            };

            return(view);
        }
        /// <summary>
        /// Creates the industry ListView.
        /// </summary>
        /// <param name="selectedId">The selected identifier.</param>
        /// <param name="selectedDescription">The selected description.</param>
        /// <param name="industryCollection">The industry collection.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">industryCollection</exception>
        public IIndustryListView CreateIndustryListView(int selectedId, string selectedDescription, IList <IIndustry> industryCollection, string message)
        {
            if (industryCollection == null)
            {
                throw new ArgumentNullException(nameof(industryCollection));
            }


            var returnView = new IndustryListView
            {
                IndustryCollection  = industryCollection,
                SelectedDescription = selectedDescription,
                ProcessingMessage   = message ?? ""
            };

            return(returnView);
        }
        /// <summary>
        /// Creates the industry ListView.
        /// </summary>
        /// <param name="IndustryCollection">The industry collection.</param>
        /// <param name="selectedIndustry"></param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">IndustryCollection</exception>
        public IIndustryListView CreateIndustryListView(IList <IIndustry> IndustryCollection, string selectedIndustry, string message)
        {
            if (IndustryCollection == null)
            {
                throw new ArgumentNullException(nameof(IndustryCollection));
            }

            var filterList = IndustryCollection.Where(x => x.IndustryName.Contains(string.IsNullOrEmpty(selectedIndustry)
                ? x.IndustryName
                : selectedIndustry)).ToList();

            var returnView = new IndustryListView
            {
                IndustryCollection = filterList,
                ProcessingMessage  = message ?? ""
            };

            return(returnView);
        }