Mercurial > silverbladetech
annotate SilverlightExampleApp/SilverlightExampleApp.Web/Secure/ClientDataService.svc.cs @ 77:86ed4919b126
Working version!
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Mon, 23 Apr 2012 22:06:05 +0100 |
parents | 3591c26bd63e |
children |
rev | line source |
---|---|
49
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System.Collections.Generic; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using System.ServiceModel; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using System.ServiceModel.Activation; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using SilverlightExampleApp.Interfaces.Models; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using SilverlightExampleApp.Interfaces.Services; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 using SilverlightExampleApp.Web.Repositories; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 namespace SilverlightExampleApp.Web.Secure |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 [ServiceContract(Namespace = "")] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 [SilverlightFaultBehavior] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 public class ClientDataService : IClientDataService |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 private readonly IRepository<IClient> _repo; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 public ClientDataService() : this(new ClientMockRepository()) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 public ClientDataService(IRepository<IClient> repo) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 _repo = repo; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 public IClient Get(int id) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 return _repo.Get(id); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 public IList<IClient> GetAll() |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 return _repo.GetAll(); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 public void Insert(IClient item) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 _repo.Insert(item); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 public void Update(IClient item) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48 _repo.Update(item); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 public void Delete(IClient item) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 _repo.Delete(item); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57 } |