Changeset 4442
- Timestamp:
- 09/20/10 05:16:33 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.OKB/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.OKB/3.3/AdminService.cs
r4434 r4442 32 32 [ServiceBehavior(IncludeExceptionDetailInFaults = true)] 33 33 public class AdminService : IAdminService { 34 #region Platform Methods 35 public Platform GetPlatform(long platformId) { 36 using (OKBDataContext okb = new OKBDataContext()) { 37 return okb.Platforms.FirstOrDefault(p => p.Id == platformId); 38 } 39 } 40 public IEnumerable<Platform> GetPlatforms() { 41 using (OKBDataContext okb = new OKBDataContext()) { 42 return okb.Platforms.ToArray(); 43 } 44 } 45 public void StorePlatform(Platform platform) { 46 using (OKBDataContext okb = new OKBDataContext()) { 47 Platform original = okb.Platforms.FirstOrDefault(p => p.Id == platform.Id); 48 if (original == null) { 49 okb.Platforms.InsertOnSubmit(new Platform() { 50 Name = platform.Name, 51 Description = platform.Description 52 }); 53 } else { 54 original.Name = platform.Name; 55 original.Description = platform.Description; 56 } 57 okb.SubmitChanges(); 58 } 59 } 60 public void DeletePlatform(long platformId) { 61 using (OKBDataContext okb = new OKBDataContext()) { 62 Platform platform = okb.Platforms.FirstOrDefault(p => p.Id == platformId); 63 if (platform != null) { 64 okb.Platforms.DeleteOnSubmit(platform); 65 okb.SubmitChanges(); 66 } 67 } 68 } 69 #endregion 70 71 #region AlgorithmClass Methods 34 72 public AlgorithmClass GetAlgorithmClass(long algorithmClassId) { 35 73 using (OKBDataContext okb = new OKBDataContext()) { … … 66 104 } 67 105 } 68 106 #endregion 107 108 #region Algorithm Methods 69 109 public Algorithm GetAlgorithm(long algorithmId) { 70 110 using (OKBDataContext okb = new OKBDataContext()) { … … 83 123 okb.Algorithms.InsertOnSubmit(new Algorithm() { 84 124 Name = algorithm.Name, 85 Description = algorithm.Description 125 Description = algorithm.Description, 126 PlatformId = algorithm.PlatformId, 127 AlgorithmClassId = algorithm.AlgorithmClassId 86 128 }); 87 129 } else { 88 130 original.Name = algorithm.Name; 89 131 original.Description = algorithm.Description; 132 original.PlatformId = algorithm.PlatformId; 133 original.AlgorithmClassId = algorithm.AlgorithmClassId; 90 134 } 91 135 okb.SubmitChanges(); … … 101 145 } 102 146 } 103 104 /// <summary> 105 /// Gets all available platforms. 106 /// </summary> 107 /// <returns>A list of <see cref="Platform"/>s.</returns> 108 public Platform[] GetPlatforms() { 109 using (OKBDataContext okb = new OKBDataContext()) { 110 return okb.Platforms.ToArray(); 111 } 112 } 147 #endregion 113 148 114 149 /// <summary> -
trunk/sources/HeuristicLab.Services.OKB/3.3/Interfaces/IAdminService.cs
r4426 r4442 32 32 public interface IAdminService { 33 33 [OperationContract] 34 Platform GetPlatform(long platformId); 35 [OperationContract] 36 IEnumerable<Platform> GetPlatforms(); 37 [OperationContract] 38 void StorePlatform(Platform platform); 39 [OperationContract] 40 void DeletePlatform(long platformId); 41 42 [OperationContract] 34 43 AlgorithmClass GetAlgorithmClass(long algorithmClassId); 35 44 [OperationContract] … … 50 59 51 60 52 53 54 55 /// <summary>56 /// Gets all available platforms.57 /// </summary>58 /// <returns>A list of <see cref="Platform"/>s.</returns>59 [OperationContract]60 Platform[] GetPlatforms();61 61 62 62 /// <summary> -
trunk/sources/HeuristicLab.Services.OKB/3.3/app.config
r4407 r4442 33 33 </mexHttpBinding> 34 34 <wsHttpBinding> 35 <binding name="DefaultWsHttpBinding" >35 <binding name="DefaultWsHttpBinding" maxReceivedMessageSize="2147483647"> 36 36 <security mode="Message"> 37 37 <message clientCredentialType="UserName" />
Note: See TracChangeset
for help on using the changeset viewer.