public ActionResult WellCompletionTypes()
        {
            var wellCompletionTypeList = new WellCompletionTypeServices().GetAllOrderedWellCompletionTypes() ?? new List <WellCompletionType>();

            if (!wellCompletionTypeList.Any())
            {
                ViewBag.Title = "Well Completion Type SetUp";
                return(View(wellCompletionTypeList));
            }

            ViewBag.Title = "Manage Well Completion Types";
            return(View(wellCompletionTypeList));
        }
        public ViewResult WellCompletionIntervals()
        {
            var wellCompletionList = new WellCompletionServices().GetAllOrderedWellCompletions() ?? new List <WellCompletion>();

            if (!wellCompletionList.Any())
            {
                ViewBag.Edit  = 1;
                ViewBag.Title = "Well Completion SetUp";
                var wellCompletionTypeList = new WellCompletionTypeServices().GetAllOrderedWellCompletionTypes() ?? new List <WellCompletionType>();

                if (!wellCompletionTypeList.Any())
                {
                    ViewBag.Edit  = 0;
                    ViewBag.Title = "Well Completion Type SetUp";
                    return(View("~/Views/WellCompletionType/WellCompletionTypes.cshtml", new List <WellCompletionType>()));
                }
            }

            wellCompletionList.ForEach(m =>
            {
                m.WellName = m.Well.Name;
                m.WellCompletionTypeName = m.WellCompletionType.Type;
                m.EquipmentName          = m.Equipment.Name;
            });

            var wellCompletionIntervalList = new WellCompletionIntervalServices().GetAllOrderedWellCompletionIntervals() ?? new List <WellCompletionInterval>();

            if (!wellCompletionIntervalList.Any())
            {
                ViewBag.Edit  = 0;
                ViewBag.Title = "Well Completion Interval SetUp";
                return(View(Tuple.Create(wellCompletionList, new List <WellCompletionInterval>())));
            }

            wellCompletionIntervalList.ForEach(m =>
            {
                m.DatecomPletedString = m.DateCompleted;
                m.WellName            = wellCompletionList.Find(x => x.WellId == m.WellCompletion.WellId).Well.Name;
            });

            var txx = Tuple.Create(wellCompletionList, wellCompletionIntervalList);

            ViewBag.Title = "Manage Well Completion Intervals";
            return(View(txx));
        }