forked from ServiceStack/ServiceStack.Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestions.cs
More file actions
114 lines (99 loc) · 3.29 KB
/
Questions.cs
File metadata and controls
114 lines (99 loc) · 3.29 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface.ServiceModel;
namespace RedisStackOverflow.ServiceModel
{
/// <summary>
/// Define your ServiceStack web service request (i.e. the Request DTO).
/// </summary>
[Route("/questions/{QuestionId}/stats")]
public class QuestionStats
{
public long QuestionId { get; set; }
}
public class QuestionStat
{
public int VotesUpCount { get; set; }
public int VotesDownCount { get; set; }
public int VotesTotal { get; set; }
}
/// <summary>
/// Define your ServiceStack web service response (i.e. Response DTO).
/// </summary>
public class QuestionStatsResponse
{
public QuestionStat Result { get; set; }
}
/// <summary>
/// Define your ServiceStack web service request (i.e. the Request DTO).
/// </summary>
[Route("/questions", "POST")]
[Route("/questions/{Id}")]
public class Question
{
public Question()
{
this.Tags = new List<string>();
}
public long Id { get; set; }
public long UserId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public DateTime CreatedDate { get; set; }
public List<string> Tags { get; set; }
}
/// <summary>
/// Define your ServiceStack web service response (i.e. Response DTO).
/// </summary>
public class QuestionResponse : IHasResponseStatus
{
public QuestionResult Result { get; set; }
/// <summary>
/// Gets or sets the ResponseStatus. The built-in Ioc used with ServiceStack autowires this property with service exceptions.
/// </summary>
public ResponseStatus ResponseStatus { get; set; }
}
/// <summary>
/// Define your ServiceStack web service request (i.e. the Request DTO).
/// </summary>
[Route("/questions", "GET")]
[Route("/questions/page/{Page}")]
[Route("/questions/tagged/{Tag}")]
[Route("/users/{UserId}/questions")]
public class Questions
{
public int? Page { get; set; }
public string Tag { get; set; }
public long? UserId { get; set; }
}
/// <summary>
/// Define your ServiceStack web service response (i.e. Response DTO).
/// </summary>
public class QuestionsResponse
{
public QuestionsResponse()
{
//Comment this out if you wish to receive the response status.
this.ResponseStatus = new ResponseStatus();
}
public List<QuestionResult> Results { get; set; }
/// <summary>
/// Gets or sets the ResponseStatus. The built-in Ioc used with ServiceStack autowires this property with service exceptions.
/// </summary>
public ResponseStatus ResponseStatus { get; set; }
}
public class QuestionResult
{
public QuestionResult()
{
this.Answers = new List<AnswerResult>();
}
public Question Question { get; set; }
public User User { get; set; }
public int AnswersCount { get; set; }
public int VotesUpCount { get; set; }
public int VotesDownCount { get; set; }
public List<AnswerResult> Answers { get; set; }
}
}