Пример #1
0
        public IHttpActionResult UpdateProject(PROJECT_IMPACT project)
        {
            try
            {
                var repos = new TDAssetRespository();

                PROJECT_IMPACT updateProject = tdmEntities.PROJECT_IMPACT.First(x => x.ID == project.ID);

                updateProject.IS_DELETED   = project.IS_DELETED;
                updateProject.SUBJECT_ID   = project.SUBJECT_ID;
                updateProject.SUBJECT_NAME = project.SUBJECT_NAME;
                updateProject.PUBLISH_DATE = project.PUBLISH_DATE;
                updateProject.IS_PUBLISHED = project.IS_PUBLISHED;
                updateProject.UPDATE_BY    = project.UPDATE_BY;
                updateProject.UPDATE_DATE  = project.UPDATE_DATE;
                updateProject.CREATE_DATE  = project.CREATE_DATE;
                updateProject.CREATE_BY    = project.CREATE_BY;
                updateProject.PROVINCE_ID  = project.PROVINCE_ID;
                updateProject.AMPHOE_ID    = project.AMPHOE_ID;
                updateProject.TAMBOL_ID    = project.TAMBOL_ID;
                updateProject.Shape        = project.Shape != null ? project.Shape : null;
                tdmEntities.SaveChanges();

                repos.AddPROJECT_IMPACT_GEOMETRY(updateProject);

                return(Json(project, jsonSetting));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }
Пример #2
0
        public IHttpActionResult AddProject(PROJECT_IMPACT project)
        {
            var repos = new TDAssetRespository();

            try
            {
                project.ID = 0;
                PROJECT_IMPACT saveProject = tdmEntities.PROJECT_IMPACT.Add(project);
                tdmEntities.SaveChanges();

                repos.AddPROJECT_IMPACT_GEOMETRY(saveProject);

                return(Json(saveProject, jsonSetting));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }