comparison 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
comparison
equal deleted inserted replaced
48:d617b54e1f47 49:502f5f365649
1 using System.Collections.Generic;
2 using System.ServiceModel;
3 using System.ServiceModel.Activation;
4 using SilverlightExampleApp.Interfaces.Models;
5 using SilverlightExampleApp.Interfaces.Services;
6 using SilverlightExampleApp.Web.Models;
7 using SilverlightExampleApp.Web.Repositories;
8
9 namespace SilverlightExampleApp.Web.Secure
10 {
11 [ServiceContract(Namespace = "")]
12 [SilverlightFaultBehavior]
13 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
14 public class ClientDataService : IClientDataService
15 {
16 private readonly IRepository<IClient> _repo;
17
18 public ClientDataService() : this(new ClientMockRepository())
19 {
20
21 }
22
23 public ClientDataService(IRepository<IClient> repo)
24 {
25 _repo = repo;
26 }
27
28 [OperationContract]
29 public IClient Get(int id)
30 {
31 return _repo.Get(id);
32 }
33
34 [OperationContract]
35 public IList<IClient> GetAll()
36 {
37 return _repo.GetAll();
38 }
39
40 [OperationContract]
41 public void Insert(IClient item)
42 {
43 _repo.Insert(item);
44 }
45
46 [OperationContract]
47 public void Update(IClient item)
48 {
49 _repo.Update(item);
50 }
51
52 [OperationContract]
53 public void Delete(IClient item)
54 {
55 _repo.Delete(item);
56 }
57 }
58 }