diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.cs
index 48e33f8..77b0654 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.cs
@@ -891,18 +891,18 @@ public string BaseUrl
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task GetAllQuestionsWithAnswersAsync(GetAllQuestionsWithAnswersRequestContract body)
+ public virtual System.Threading.Tasks.Task AddAsync(CreateQuestionRequestContract body)
{
- return GetAllQuestionsWithAnswersAsync(body, System.Threading.CancellationToken.None);
+ return AddAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task GetAllQuestionsWithAnswersAsync(GetAllQuestionsWithAnswersRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task AddAsync(CreateQuestionRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/GetAllQuestionsWithAnswers");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/Add");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -940,7 +940,7 @@ public virtual async System.Threading.Tasks.Task(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -969,18 +969,18 @@ public virtual async System.Threading.Tasks.TaskSuccess
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task AddAsync(CreateQuestionRequestContract body)
+ public virtual System.Threading.Tasks.Task UpdateAsync(UpdateQuestionRequestContract body)
{
- return AddAsync(body, System.Threading.CancellationToken.None);
+ return UpdateAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task AddAsync(CreateQuestionRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task UpdateAsync(UpdateQuestionRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/Add");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/Update");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -992,7 +992,7 @@ public virtual async System.Threading.Tasks.Task AddAsync(
var content_ = new System.Net.Http.StringContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Method = new System.Net.Http.HttpMethod("PUT");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
PrepareRequest(client_, request_, urlBuilder_);
@@ -1018,7 +1018,7 @@ public virtual async System.Threading.Tasks.Task AddAsync(
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -1047,18 +1047,18 @@ public virtual async System.Threading.Tasks.Task AddAsync(
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task UpdateAsync(UpdateQuestionRequestContract body)
+ public virtual System.Threading.Tasks.Task GetAllQuestionsWithAnswersAsync(GetAllQuestionsWithAnswersRequestContract body)
{
- return UpdateAsync(body, System.Threading.CancellationToken.None);
+ return GetAllQuestionsWithAnswersAsync(body, System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task UpdateAsync(UpdateQuestionRequestContract body, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetAllQuestionsWithAnswersAsync(GetAllQuestionsWithAnswersRequestContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/Update");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Question/GetAllQuestionsWithAnswers");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -1070,7 +1070,7 @@ public virtual async System.Threading.Tasks.Task(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -2054,8 +2054,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
public partial class CreateAnswerRequestContract : System.ComponentModel.INotifyPropertyChanged
{
private long _questionId;
- private string _englishContent;
- private string _persianContent;
+ private System.Collections.Generic.ICollection _contents;
private string _uniqueIdentity;
[Newtonsoft.Json.JsonProperty("questionId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
@@ -2073,31 +2072,16 @@ public long QuestionId
}
}
- [Newtonsoft.Json.JsonProperty("englishContent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string EnglishContent
+ [Newtonsoft.Json.JsonProperty("contents", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection Contents
{
- get { return _englishContent; }
+ get { return _contents; }
set
{
- if (_englishContent != value)
+ if (_contents != value)
{
- _englishContent = value;
- RaisePropertyChanged();
- }
- }
- }
-
- [Newtonsoft.Json.JsonProperty("persianContent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string PersianContent
- {
- get { return _persianContent; }
-
- set
- {
- if (_persianContent != value)
- {
- _persianContent = value;
+ _contents = value;
RaisePropertyChanged();
}
}
@@ -2131,34 +2115,34 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
public partial class CreateQuestionRequestContract : System.ComponentModel.INotifyPropertyChanged
{
- private string _title;
private string _uniqueIdentity;
+ private System.Collections.Generic.ICollection _titles;
- [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string Title
+ [Newtonsoft.Json.JsonProperty("uniqueIdentity", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string UniqueIdentity
{
- get { return _title; }
+ get { return _uniqueIdentity; }
set
{
- if (_title != value)
+ if (_uniqueIdentity != value)
{
- _title = value;
+ _uniqueIdentity = value;
RaisePropertyChanged();
}
}
}
- [Newtonsoft.Json.JsonProperty("uniqueIdentity", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string UniqueIdentity
+ [Newtonsoft.Json.JsonProperty("titles", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection Titles
{
- get { return _uniqueIdentity; }
+ get { return _titles; }
set
{
- if (_uniqueIdentity != value)
+ if (_titles != value)
{
- _uniqueIdentity = value;
+ _titles = value;
RaisePropertyChanged();
}
}
@@ -2577,7 +2561,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
- public partial class GetAllQuestionsWithAnswersResponse : System.ComponentModel.INotifyPropertyChanged
+ public partial class GetAllQuestionsWithAnswersResponseContract : System.ComponentModel.INotifyPropertyChanged
{
private long _id;
private string _title;
@@ -2655,11 +2639,11 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
- public partial class GetAllQuestionsWithAnswersResponseListMessageContract : System.ComponentModel.INotifyPropertyChanged
+ public partial class GetAllQuestionsWithAnswersResponseContractListMessageContract : System.ComponentModel.INotifyPropertyChanged
{
private bool _isSuccess;
private ErrorContract _error;
- private System.Collections.Generic.ICollection _result;
+ private System.Collections.Generic.ICollection _result;
private bool _hasItems;
[Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
@@ -2693,7 +2677,7 @@ public ErrorContract Error
}
[Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public System.Collections.Generic.ICollection Result
+ public System.Collections.Generic.ICollection Result
{
get { return _result; }
@@ -2930,6 +2914,52 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
}
}
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
+ public partial class LanguageDataContract : System.ComponentModel.INotifyPropertyChanged
+ {
+ private string _languageName;
+ private string _data;
+
+ [Newtonsoft.Json.JsonProperty("languageName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string LanguageName
+ {
+ get { return _languageName; }
+
+ set
+ {
+ if (_languageName != value)
+ {
+ _languageName = value;
+ RaisePropertyChanged();
+ }
+ }
+ }
+
+ [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Data
+ {
+ get { return _data; }
+
+ set
+ {
+ if (_data != value)
+ {
+ _data = value;
+ RaisePropertyChanged();
+ }
+ }
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
+ {
+ var handler = PropertyChanged;
+ if (handler != null)
+ handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+ }
+ }
+
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
public partial class MessageContract : System.ComponentModel.INotifyPropertyChanged
{
@@ -3263,8 +3293,7 @@ public partial class UpdateAnswerRequestContract : System.ComponentModel.INotify
{
private long _id;
private long _questionId;
- private string _englishContent;
- private string _persianContent;
+ private System.Collections.Generic.ICollection _content;
private string _uniqueIdentity;
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
@@ -3297,31 +3326,16 @@ public long QuestionId
}
}
- [Newtonsoft.Json.JsonProperty("englishContent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string EnglishContent
- {
- get { return _englishContent; }
-
- set
- {
- if (_englishContent != value)
- {
- _englishContent = value;
- RaisePropertyChanged();
- }
- }
- }
-
- [Newtonsoft.Json.JsonProperty("persianContent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string PersianContent
+ [Newtonsoft.Json.JsonProperty("content", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection Content
{
- get { return _persianContent; }
+ get { return _content; }
set
{
- if (_persianContent != value)
+ if (_content != value)
{
- _persianContent = value;
+ _content = value;
RaisePropertyChanged();
}
}
@@ -3356,7 +3370,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
public partial class UpdateQuestionRequestContract : System.ComponentModel.INotifyPropertyChanged
{
private long _id;
- private string _title;
+ private System.Collections.Generic.ICollection _titles;
private string _uniqueIdentity;
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
@@ -3374,16 +3388,16 @@ public long Id
}
}
- [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string Title
+ [Newtonsoft.Json.JsonProperty("titles", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection Titles
{
- get { return _title; }
+ get { return _titles; }
set
{
- if (_title != value)
+ if (_titles != value)
{
- _title = value;
+ _titles = value;
RaisePropertyChanged();
}
}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.nswag.json b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.nswag.json
index 761889b..1668309 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.nswag.json
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/Connected Services/QuestionsGeneratedServices/OpenAPI.nswag.json
@@ -427,27 +427,27 @@
}
}
},
- "/api/Question/GetAllQuestionsWithAnswers": {
+ "/api/Question/Add": {
"post": {
"tags": [
"Question"
],
- "operationId": "GetAllQuestionsWithAnswers",
+ "operationId": "Add2",
"requestBody": {
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
+ "$ref": "#/components/schemas/CreateQuestionRequestContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
+ "$ref": "#/components/schemas/CreateQuestionRequestContract"
}
},
"application/*+json": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
+ "$ref": "#/components/schemas/CreateQuestionRequestContract"
}
}
}
@@ -458,17 +458,17 @@
"content": {
"text/plain": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseListMessageContract"
+ "$ref": "#/components/schemas/Int64MessageContract"
}
},
"application/json": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseListMessageContract"
+ "$ref": "#/components/schemas/Int64MessageContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseListMessageContract"
+ "$ref": "#/components/schemas/Int64MessageContract"
}
}
}
@@ -476,27 +476,27 @@
}
}
},
- "/api/Question/Add": {
- "post": {
+ "/api/Question/Update": {
+ "put": {
"tags": [
"Question"
],
- "operationId": "Add2",
+ "operationId": "Update2",
"requestBody": {
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/CreateQuestionRequestContract"
+ "$ref": "#/components/schemas/UpdateQuestionRequestContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/CreateQuestionRequestContract"
+ "$ref": "#/components/schemas/UpdateQuestionRequestContract"
}
},
"application/*+json": {
"schema": {
- "$ref": "#/components/schemas/CreateQuestionRequestContract"
+ "$ref": "#/components/schemas/UpdateQuestionRequestContract"
}
}
}
@@ -507,17 +507,17 @@
"content": {
"text/plain": {
"schema": {
- "$ref": "#/components/schemas/Int64MessageContract"
+ "$ref": "#/components/schemas/QuestionContractMessageContract"
}
},
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Int64MessageContract"
+ "$ref": "#/components/schemas/QuestionContractMessageContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/Int64MessageContract"
+ "$ref": "#/components/schemas/QuestionContractMessageContract"
}
}
}
@@ -525,27 +525,27 @@
}
}
},
- "/api/Question/Update": {
- "put": {
+ "/api/Question/GetAllQuestionsWithAnswers": {
+ "post": {
"tags": [
"Question"
],
- "operationId": "Update2",
+ "operationId": "GetAllQuestionsWithAnswers",
"requestBody": {
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/UpdateQuestionRequestContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/UpdateQuestionRequestContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
}
},
"application/*+json": {
"schema": {
- "$ref": "#/components/schemas/UpdateQuestionRequestContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersRequestContract"
}
}
}
@@ -556,17 +556,17 @@
"content": {
"text/plain": {
"schema": {
- "$ref": "#/components/schemas/QuestionContractMessageContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseContractListMessageContract"
}
},
"application/json": {
"schema": {
- "$ref": "#/components/schemas/QuestionContractMessageContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseContractListMessageContract"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/QuestionContractMessageContract"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseContractListMessageContract"
}
}
}
@@ -991,13 +991,13 @@
"type": "integer",
"format": "int64"
},
- "englishContent": {
- "type": "string",
- "nullable": true
- },
- "persianContent": {
- "type": "string",
- "nullable": true
+ "contents": {
+ "title": "List",
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "$ref": "#/components/schemas/LanguageDataContract"
+ }
},
"uniqueIdentity": {
"type": "string",
@@ -1009,13 +1009,17 @@
"type": "object",
"additionalProperties": false,
"properties": {
- "title": {
- "type": "string",
- "nullable": true
- },
"uniqueIdentity": {
"type": "string",
"nullable": true
+ },
+ "titles": {
+ "title": "List",
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "$ref": "#/components/schemas/LanguageDataContract"
+ }
}
}
},
@@ -1178,7 +1182,7 @@
}
}
},
- "GetAllQuestionsWithAnswersResponse": {
+ "GetAllQuestionsWithAnswersResponseContract": {
"type": "object",
"additionalProperties": false,
"properties": {
@@ -1204,8 +1208,8 @@
}
}
},
- "GetAllQuestionsWithAnswersResponseListMessageContract": {
- "title": "ListMessageContract",
+ "GetAllQuestionsWithAnswersResponseContractListMessageContract": {
+ "title": "ListMessageContract",
"type": "object",
"additionalProperties": false,
"properties": {
@@ -1216,11 +1220,11 @@
"$ref": "#/components/schemas/ErrorContract"
},
"result": {
- "title": "List",
+ "title": "List",
"type": "array",
"nullable": true,
"items": {
- "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponse"
+ "$ref": "#/components/schemas/GetAllQuestionsWithAnswersResponseContract"
}
},
"hasItems": {
@@ -1292,6 +1296,20 @@
}
}
},
+ "LanguageDataContract": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "languageName": {
+ "type": "string",
+ "nullable": true
+ },
+ "data": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
"MessageContract": {
"type": "object",
"additionalProperties": false,
@@ -1402,13 +1420,13 @@
"type": "integer",
"format": "int64"
},
- "englishContent": {
- "type": "string",
- "nullable": true
- },
- "persianContent": {
- "type": "string",
- "nullable": true
+ "content": {
+ "title": "List",
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "$ref": "#/components/schemas/LanguageDataContract"
+ }
},
"uniqueIdentity": {
"type": "string",
@@ -1424,9 +1442,13 @@
"type": "integer",
"format": "int64"
},
- "title": {
- "type": "string",
- "nullable": true
+ "titles": {
+ "title": "List",
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "$ref": "#/components/schemas/LanguageDataContract"
+ }
},
"uniqueIdentity": {
"type": "string",
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/EasyMicroservices.QuestionsMicroservice.Clients.csproj b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/EasyMicroservices.QuestionsMicroservice.Clients.csproj
index ef83322..e0fdaf4 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/EasyMicroservices.QuestionsMicroservice.Clients.csproj
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Clients/EasyMicroservices.QuestionsMicroservice.Clients.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.2
+ 0.0.0.3
client generated code.
EasyMicroservices@gmail.com
microservice,Question,Questions,client
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/LanguageDataContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/LanguageDataContract.cs
new file mode 100644
index 0000000..74550be
--- /dev/null
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/LanguageDataContract.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EasyMicroservices.QuestionsMicroservice.Contracts.Common
+{
+ public class LanguageDataContract
+ {
+ public string LanguageName { get; set; }
+ public string Data { get; set; }
+ }
+}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/QuestionContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/QuestionContract.cs
index ef075e3..3e93070 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/QuestionContract.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Common/QuestionContract.cs
@@ -1,4 +1,5 @@
-using EasyMicroservices.Cores.Interfaces;
+using EasyMicroservices.ContentsMicroservice.Clients.Attributes;
+using EasyMicroservices.Cores.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,6 +11,7 @@ namespace EasyMicroservices.QuestionsMicroservice.Contracts.Common
public class QuestionContract : IUniqueIdentitySchema, ISoftDeleteSchema, IDateTimeSchema
{
public long Id { get; set; }
+ [ContentLanguage]
public string Title { get; set; }
public DateTime CreationDateTime { get; set; }
public DateTime? ModificationDateTime { get; set; }
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateAnswerRequestContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateAnswerRequestContract.cs
index ded5eff..9610520 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateAnswerRequestContract.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateAnswerRequestContract.cs
@@ -3,14 +3,14 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using EasyMicroservices.QuestionsMicroservice.Contracts.Common;
namespace EasyMicroservices.QuestionsMicroservice.Contracts.Requests
{
public class CreateAnswerRequestContract
{
public long QuestionId { get; set; }
- public string EnglishContent { get; set; }
- public string PersianContent { get; set; }
+ public List Contents { get; set; }
public string UniqueIdentity { get; set; }
}
}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateQuestionRequestContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateQuestionRequestContract.cs
index 809a046..674948a 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateQuestionRequestContract.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/CreateQuestionRequestContract.cs
@@ -1,4 +1,5 @@
-using System;
+using EasyMicroservices.QuestionsMicroservice.Contracts.Common;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,8 +9,8 @@ namespace EasyMicroservices.QuestionsMicroservice.Contracts.Requests
{
public class CreateQuestionRequestContract
{
- public string Title { get; set; }
public string UniqueIdentity { get; set; }
+ public List Titles { get; set; }
}
}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateAnswerRequestContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateAnswerRequestContract.cs
index e7507c3..16bbd54 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateAnswerRequestContract.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateAnswerRequestContract.cs
@@ -1,4 +1,5 @@
-using System;
+using EasyMicroservices.QuestionsMicroservice.Contracts.Common;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,8 +11,7 @@ public class UpdateAnswerRequestContract
{
public long Id { get; set; }
public long QuestionId { get; set; }
- public string EnglishContent { get; set; }
- public string PersianContent { get; set; }
+ public List Content { get; set; }
public string UniqueIdentity { get; set; }
}
}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateQuestionRequestContract.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateQuestionRequestContract.cs
index d34a94c..aa91318 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateQuestionRequestContract.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.Domain/Contracts/Requests/UpdateQuestionRequestContract.cs
@@ -1,4 +1,5 @@
-using System;
+using EasyMicroservices.QuestionsMicroservice.Contracts.Common;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,7 +10,7 @@ namespace EasyMicroservices.QuestionsMicroservice.Contracts.Requests
public class UpdateQuestionRequestContract
{
public long Id { get; set; }
- public string Title { get; set; }
+ public List Titles { get; set; }
public string UniqueIdentity { get; set; }
}
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/AnswerController.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/AnswerController.cs
index eef05a5..91a7ecf 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/AnswerController.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/AnswerController.cs
@@ -6,6 +6,7 @@
using EasyMicroservices.QuestionsMicroservice.Contracts.Requests;
using EasyMicroservices.QuestionsMicroservice.Database.Entities;
using EasyMicroservices.ServiceContracts;
+using Microsoft.AspNetCore.Mvc;
namespace EasyMicroservices.QuestionsMicroservice.WebApi.Controllers
{
@@ -43,19 +44,11 @@ public override async Task> Add(CreateAnswerRequestContrac
var addContentResult = await _contentClient.AddContentWithKeyAsync(new AddContentWithKeyRequestContract
{
Key = $"{getAnswerResult.Result.UniqueIdentity}-Content",
- LanguageData = new List
+ LanguageData = request.Contents.Select(x=> new Contents.GeneratedServices.LanguageDataContract
{
- new LanguageDataContract
- {
- Language = "fa-IR",
- Data = request.PersianContent
- },
- new LanguageDataContract
- {
- Language = "en-US",
- Data = request.EnglishContent
- }
- }
+ Language = x.LanguageName,
+ Data = x.Data
+ }).ToList(),
});
if (addContentResult.IsSuccess)
@@ -92,19 +85,11 @@ public override async Task> Update(UpdateAnswerR
var UpdateResponse = await _contentClient.UpdateContentWithKeyAsync(new AddContentWithKeyRequestContract
{
Key = $"{answerResult.Result.UniqueIdentity}-Content",
- LanguageData = new List
+ LanguageData = request.Content.Select(x => new Contents.GeneratedServices.LanguageDataContract
{
- new LanguageDataContract
- {
- Language = "fa-IR",
- Data = request.PersianContent
- },
- new LanguageDataContract
- {
- Language = "en-US",
- Data = request.EnglishContent
- }
- }
+ Language = x.LanguageName,
+ Data = x.Data
+ }).ToList(),
});
if (UpdateResponse.IsSuccess)
diff --git a/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/QuestionController.cs b/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/QuestionController.cs
index 89d3c7d..de3ca93 100644
--- a/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/QuestionController.cs
+++ b/src/CSharp/EasyMicroservices.QuestionsMicroservice.WebApi/Controllers/QuestionController.cs
@@ -9,7 +9,8 @@
using EasyMicroservices.ServiceContracts;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
+using Microsoft.Extensions.Hosting;
+using System.Threading.Tasks;
namespace EasyMicroservices.QuestionsMicroservice.WebApi.Controllers
{
@@ -29,7 +30,59 @@ public QuestionController(IContractLogic("RootAddresses:Content");
_contentClient = new(_contentRoot, new HttpClient());
}
+ public override async Task> Add(CreateQuestionRequestContract request, CancellationToken cancellationToken = default)
+ {
+ var addQuestionResult = await base.Add(request, cancellationToken);
+ if (addQuestionResult.IsSuccess)
+ {
+ var getQuestionId = await base.GetById(new Cores.Contracts.Requests.GetIdRequestContract { Id = addQuestionResult.Result });
+ var addContent = await _contentClient.AddContentWithKeyAsync(new AddContentWithKeyRequestContract
+ {
+ Key = $"{getQuestionId.Result.UniqueIdentity}-Title",
+ LanguageData = request.Titles.Select(x => new Contents.GeneratedServices.LanguageDataContract
+ {
+ Data = x.Data,
+ Language = x.LanguageName,
+ }).ToList(),
+ });
+ if (addContent.IsSuccess)
+ return addQuestionResult.Result;
+
+ await _contentClient.HardDeleteByIdAsync(new Int64DeleteRequestContract
+ {
+ Id = addQuestionResult.Result
+ });
+ return (EasyMicroservices.ServiceContracts.FailedReasonType.Empty, "An error has occured.");
+ }
+ return (EasyMicroservices.ServiceContracts.FailedReasonType.Empty, "An error has occured.");
+ }
+ public override async Task> Update(UpdateQuestionRequestContract request, CancellationToken cancellationToken = default)
+ {
+ var updateQuestion = await base.Update(request, cancellationToken);
+ if (updateQuestion.IsSuccess)
+ {
+ var getQuestionId = await base.GetById(new Cores.Contracts.Requests.GetIdRequestContract { Id = updateQuestion.Result.Id });
+ var addContent = await _contentClient.AddContentWithKeyAsync(new AddContentWithKeyRequestContract
+ {
+ Key = $"{getQuestionId.Result.UniqueIdentity}-Title",
+ LanguageData = request.Titles.Select(x => new Contents.GeneratedServices.LanguageDataContract
+ {
+ Data = x.Data,
+ Language = x.LanguageName,
+ }).ToList(),
+ });
+ if (addContent.IsSuccess)
+ return updateQuestion.Result;
+ await _contentClient.HardDeleteByIdAsync(new Int64DeleteRequestContract
+ {
+ Id = updateQuestion.Result.Id
+ });
+ return (EasyMicroservices.ServiceContracts.FailedReasonType.Empty, "An error has occured.");
+ }
+ return (EasyMicroservices.ServiceContracts.FailedReasonType.Empty, "An error has occured.");
+
+ }
[HttpPost]
public async Task> GetAllQuestionsWithAnswers(GetAllQuestionsWithAnswersRequestContract request)
{
@@ -38,14 +91,14 @@ public async Task();
- var questionsWithAnswers = questions.Result.Select(o => new GetAllQuestionsWithAnswersResponseContract
+ var task = questions.Result.Select(async o => new GetAllQuestionsWithAnswersResponseContract
{
Id = o.Id,
- Title = o.Title,
+ Title = await ResolveQuestionContent(o , request.LanguageName),
UniqueIdentity = o.UniqueIdentity,
Answers = Task.WhenAll(o.Answers.Select(async x => new AnswerContract
{
- Id = o.Id,
+ Id = x.Id,
Content = await ResolveAnswerContent(x, request.LanguageName),
CreationDateTime = x.CreationDateTime,
DeletedDateTime = x.DeletedDateTime,
@@ -55,7 +108,7 @@ public async Task ResolveAnswerContent(AnswerContract request, string L
var content = request.Content;
return content;
}
+ private async Task ResolveQuestionContent(QuestionContract request, string LanguageName)
+ {
+ ContentLanguageHelper contentHelper = new(_contentClient);
+ await contentHelper.ResolveContentLanguage(request, LanguageName);
+ var title = request.Title;
+ return title;
+ }
}
}