diff SilverlightExampleApp/SilverlightExampleApp.Web/Secure/ClientDataService.svc.cs @ 49:502f5f365649

Initial load for Silverlight Example Application
author Steven Hollidge <stevenhollidge@hotmail.com>
date Tue, 17 Apr 2012 17:57:52 +0100
parents
children 3591c26bd63e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SilverlightExampleApp/SilverlightExampleApp.Web/Secure/ClientDataService.svc.cs	Tue Apr 17 17:57:52 2012 +0100
@@ -0,0 +1,58 @@
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Activation;
+using SilverlightExampleApp.Interfaces.Models;
+using SilverlightExampleApp.Interfaces.Services;
+using SilverlightExampleApp.Web.Models;
+using SilverlightExampleApp.Web.Repositories;
+
+namespace SilverlightExampleApp.Web.Secure
+{
+    [ServiceContract(Namespace = "")]
+    [SilverlightFaultBehavior]
+    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
+    public class ClientDataService : IClientDataService
+    {
+        private readonly IRepository<IClient> _repo;
+
+        public ClientDataService() : this(new ClientMockRepository())
+        {
+            
+        }
+
+        public ClientDataService(IRepository<IClient> repo)
+        {
+            _repo = repo;
+        }
+
+        [OperationContract]
+        public IClient Get(int id)
+        {
+            return _repo.Get(id);
+        }
+
+        [OperationContract]
+        public IList<IClient> GetAll()
+        {
+            return _repo.GetAll();
+        }
+
+        [OperationContract]
+        public void Insert(IClient item)
+        {
+            _repo.Insert(item);
+        }
+
+        [OperationContract]
+        public void Update(IClient item)
+        {
+            _repo.Update(item);
+        }
+
+        [OperationContract]
+        public void Delete(IClient item)
+        {
+            _repo.Delete(item);
+        }
+    }
+}