public void DeleteProject(ProjectDb projectDb)
 {
     using (var context = new QualificationDbContext())
     {
         context.Entry(projectDb).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
 public ProjectDb AddProject(ProjectDb projectDb)
 {
     using (var context = new QualificationDbContext())
     {
         context.Projects.Add(projectDb);
         context.SaveChanges();
         return(projectDb);
     }
 }
Пример #3
0
        private ProjectDb ToProjectDb(Project project)
        {
            var projectDb = new ProjectDb();

            projectDb.Id     = project.ID;
            projectDb.Name   = project.Name;
            projectDb.Models = new List <ModelDb>();
            foreach (var model in project.Models)
            {
                var modelDb = ToModelDb(model);
                projectDb.Models.Add(modelDb);
            }
            return(projectDb);
        }
Пример #4
0
        private Project ToProject(ProjectDb projectDb)
        {
            var project = new Project();

            project.ID     = projectDb.Id;
            project.Name   = projectDb.Name;
            project.Models = new List <Model>();
            foreach (var modelDb in projectDb.Models)
            {
                var model = ToModel(modelDb);
                project.Models.Add(model);
            }
            return(project);
        }