Пример #1
0
 public List <Project> SaveProject(Project project)
 {
     using (CarWashConnection con = new CarWashConnection())
     {
         con.Projects.Add(project);
         con.SaveChanges();
         return(con.Projects.ToList());
     }
 }
Пример #2
0
 public List <Project> DeleteProject(Project project)
 {
     using (CarWashConnection con = new CarWashConnection())
     {
         var entity = con.Projects.FirstOrDefault(g => g.Id == project.Id);
         if (entity != null)
         {
             con.Projects.Remove(entity);
             con.SaveChanges();
         }
         return(con.Projects.ToList());
     }
 }