Example #1
0
 public bool DeleteClientFolder(ClientFolder folder)
 {
     try
     {
         using (var entities = new ServiceBasedClientDBEntities())
         {
             var folderModifier = entities.Clients.Where((client) =>
                                                         client.Name == folder.Name && client.FamilyName == folder.FamilyName &&
                                                         client.Age == folder.Age && client.Sex == folder.Sex).ToArray();
             if (folderModifier != null)
             {
                 entities.Clients.RemoveRange(folderModifier);
                 entities.SaveChanges();
             }
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Example #2
0
 public bool ModifyClientFolder(ClientFolder origin, ClientFolder folder)
 {
     try
     {
         using (var entities = new ServiceBasedClientDBEntities())
         {
             var folderModifier = entities.Clients.FirstOrDefault(
                 (client) => client.Name == origin.Name && client.FamilyName == origin.FamilyName);
             if (folderModifier != null)
             {
                 folderModifier.Name       = folder.Name;
                 folderModifier.FamilyName = folder.FamilyName;
                 folderModifier.Sex        = folder.Sex;
                 folderModifier.Age        = folder.Age;
                 entities.SaveChanges();
             }
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }