Repository navigation
Expand file tree
/
Copy pathServiceLayer-Service.cs
More file actions
60 lines (49 loc) · 1.71 KB
/
Copy pathServiceLayer-Service.cs
File metadata and controls
60 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using Microsoft.Practices.Unity;
using Microsoft.Http;
using Microsoft.Http.Headers;
using System.Runtime.Serialization.Json;
namespace <mynamespace>
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class <class name>
{
private IProjectsRepository ProjectRepo { get; set; }
public ProjectsService()
{
ProjectRepo = ServiceBootStrapper.GetContainer().Resolve<IProjectsRepository>();
}
[Description("")]
[WebGet(UriTemplate = "Search/?projectId={p1}&....")]
public IEnumerable<ProjectSearchList> GetProjects(string p1, string p2,
string p3)
{
var object = ProjectRepo.ProjectSearchList(...);
...
...
return object.Data;
}
[Description("")]
[WebGet(UriTemplate = "<name>/{p1}/{p2}")]
public SOWDetails Get(string p1, string p2)
{
var object = //call data repository class here
if (sowDetailsTransaction.Status == ResultStatus.Error)
{
Logger.Error.Log(.......);
throw new WebFaultException(HttpStatusCode.InternalServerError);
//throw new System.Exception(sowDetailsTransaction.Message); // get exact error
}
return object.Data;
}
}
}