annotate 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
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.Models;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 using SilverlightExampleApp.Web.Repositories;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 namespace SilverlightExampleApp.Web.Secure
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 [ServiceContract(Namespace = "")]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 [SilverlightFaultBehavior]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 public class ClientDataService : IClientDataService
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 private readonly IRepository<IClient> _repo;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 public ClientDataService() : this(new ClientMockRepository())
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 public ClientDataService(IRepository<IClient> repo)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25 _repo = repo;
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 [OperationContract]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 public IClient Get(int id)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31 return _repo.Get(id);
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
34 [OperationContract]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
35 public IList<IClient> GetAll()
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
36 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 return _repo.GetAll();
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
40 [OperationContract]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
41 public void Insert(IClient item)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
42 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43 _repo.Insert(item);
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
46 [OperationContract]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
47 public void Update(IClient item)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
48 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
49 _repo.Update(item);
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
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
52 [OperationContract]
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
53 public void Delete(IClient item)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
54 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
55 _repo.Delete(item);
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 }
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
58 }