コード例 #1
0
 public void CreateNewProject(Project project)
 {
     var loggedInUserId = UserSession.LoggedInUser.UserId.ToString();
     using(var model = new fundgridEntities())
     {
         var newProject = new Fundgrid.Data.project()
                         {
                             name = project.Name,
                             description = project.Description,
                             owner_id = loggedInUserId,
                         };
         model.projects.Add(newProject);
         model.SaveChanges();
     }
 }
コード例 #2
0
        public void RemoveProject(int projectId)
        {
            var selectedProject = new project();
            int gridId;
            using (var model = new fundgridEntities())
            {
                selectedProject = (from p in model.projects
                                   where p.id == projectId
                                   select p).FirstOrDefault();

                gridId = selectedProject.grids.Count > 0 ? selectedProject.grids.FirstOrDefault().id : 0;
            }

            if (gridId > 0)
            {
                removeGridItems(gridId);
                removeGrid(gridId);
            }
            removeProject(projectId);
        }