public ActionResult UpdateScope(ScopeViewModel viewModel)
        {
            int projectVersionId = viewModel.Scope.ProjectVersionId;
            string year = viewModel.Current.Name;
            //Get the model from the database
            ScopeModel model = _surveyRepository.GetScopeModel(projectVersionId, year);
            Project project = _surveyRepository.GetProjectBasics(projectVersionId);
            //Update it
            model.ProjectDescription = viewModel.Scope.ProjectDescription;
            model.ProjectVersionId = viewModel.Scope.ProjectVersionId;
            model.OpenToPublicYear = viewModel.Scope.OpenToPublicYear;
            model.BeginConstructionYear = viewModel.Scope.BeginConstructionYear;

            if (!ModelState.IsValid)
            {
                return View("Scope", viewModel);
            }

            //Send update to repo
            try
            {
                _surveyRepository.UpdateProjectScope(model, project);

            }
            catch (Exception ex)
            {
                return Json(new
                {
                    message = "Changes could not be stored. An error has been logged."
                    ,
                    error = "true"
                    ,
                    exceptionMessage = ex.Message
                });
            }
            return Json(new
            {
                data = false
                ,
                message = "Changes successfully saved."
                ,
                error = "false"
            });
        }
        public ScopeViewModel GetScopeViewModel(int projectVersionId, string year)
        {
            var result = new ScopeViewModel();

            // get project summary info
            result.Scope = this.GetScopeModel(projectVersionId, year);
            result.Project = this.GetProjectBasics(projectVersionId);
            //result.Project = new Project() { ProjectVersionId = projectVersionId };
            result.Current = GetSurvey(year);// GetProjectSummary(projectVersionId, planYear);
            result.Segments = GetProjectSegments(projectVersionId);

            var cycle = GetCurrentCycle(GetYearId(GetCurrentRtpPlanYear(), DRCOG.Domain.Enums.TimePeriodType.PlanYear));

            IList<SqlParameter> parms = new List<SqlParameter>();
            parms.Add(new SqlParameter("@CycleId", cycle.Id));

            result.AvailableNetworks = GetLookupCollection("[dbo].[Lookup_GetNetworks]", "Id", "Label", parms);

            result.AvailableImprovementTypes = AvailableImprovementTypes(24);
            parms = new List<SqlParameter>();
            parms.Add(new SqlParameter("@TypeId", (int)DRCOG.Domain.Enums.GISCategoryType.FacilityType));
            result.AvailableFacilityTypes = GetLookupCollection("[dbo].[Lookup_GISCategoriesByType]", "Id", "Label", parms);

            IList<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@StatusTypeID", (int)DRCOG.Domain.Enums.StatusType.SurveyUpdateStatus));
            result.AvailableUpdateStatus = GetLookupCollection("Lookup_GetStatuses", "Id", "Label", paramList);

            return result;
        }