aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Models/Http
diff options
context:
space:
mode:
Diffstat (limited to 'BackEnd/Timeline/Models/Http')
-rw-r--r--BackEnd/Timeline/Models/Http/CommonDataResponse.cs18
-rw-r--r--BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs54
-rw-r--r--BackEnd/Timeline/Models/Http/CommonPutResponse.cs43
-rw-r--r--BackEnd/Timeline/Models/Http/CommonResponse.cs111
-rw-r--r--BackEnd/Timeline/Models/Http/Resource.Designer.cs99
-rw-r--r--BackEnd/Timeline/Models/Http/Resource.resx132
6 files changed, 346 insertions, 111 deletions
diff --git a/BackEnd/Timeline/Models/Http/CommonDataResponse.cs b/BackEnd/Timeline/Models/Http/CommonDataResponse.cs
new file mode 100644
index 00000000..93605e8c
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonDataResponse.cs
@@ -0,0 +1,18 @@
+namespace Timeline.Models.Http
+{
+ public class CommonDataResponse<T> : CommonResponse
+ {
+ public CommonDataResponse()
+ {
+
+ }
+
+ public CommonDataResponse(int code, string message, T data)
+ : base(code, message)
+ {
+ Data = data;
+ }
+
+ public T Data { get; set; } = default!;
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs b/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs
new file mode 100644
index 00000000..c8632f41
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs
@@ -0,0 +1,54 @@
+namespace Timeline.Models.Http
+{
+ /// <summary>
+ /// Common response for delete method.
+ /// </summary>
+ public class CommonDeleteResponse : CommonDataResponse<CommonDeleteResponse.ResponseData>
+ {
+ /// <summary></summary>
+ public class ResponseData
+ {
+ /// <summary></summary>
+ public ResponseData() { }
+
+ /// <summary></summary>
+ public ResponseData(bool delete)
+ {
+ Delete = delete;
+ }
+
+ /// <summary>
+ /// True if the entry is deleted. False if the entry does not exist.
+ /// </summary>
+ public bool Delete { get; set; }
+ }
+
+ /// <summary></summary>
+ public CommonDeleteResponse()
+ {
+
+ }
+
+ /// <summary></summary>
+ public CommonDeleteResponse(int code, string message, bool delete)
+ : base(code, message, new ResponseData(delete))
+ {
+
+ }
+
+ internal static CommonDeleteResponse Create(bool delete)
+ {
+ return delete ? Delete() : NotExist();
+ }
+
+ internal static CommonDeleteResponse Delete()
+ {
+ return new CommonDeleteResponse(0, Resource.MessageDeleteDelete, true);
+ }
+
+ internal static CommonDeleteResponse NotExist()
+ {
+ return new CommonDeleteResponse(0, Resource.MessageDeleteNotExist, false);
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonPutResponse.cs b/BackEnd/Timeline/Models/Http/CommonPutResponse.cs
new file mode 100644
index 00000000..06ca0bd2
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonPutResponse.cs
@@ -0,0 +1,43 @@
+namespace Timeline.Models.Http
+{
+ public class CommonPutResponse : CommonDataResponse<CommonPutResponse.ResponseData>
+ {
+ public class ResponseData
+ {
+ public ResponseData() { }
+
+ public ResponseData(bool create)
+ {
+ Create = create;
+ }
+
+ public bool Create { get; set; }
+ }
+
+ public CommonPutResponse()
+ {
+
+ }
+
+ public CommonPutResponse(int code, string message, bool create)
+ : base(code, message, new ResponseData(create))
+ {
+
+ }
+
+ internal static CommonPutResponse Create(bool create)
+ {
+ return create ? Create() : Modify();
+ }
+
+ internal static CommonPutResponse Create()
+ {
+ return new CommonPutResponse(0, Resource.MessagePutCreate, true);
+ }
+
+ internal static CommonPutResponse Modify()
+ {
+ return new CommonPutResponse(0, Resource.MessagePutModify, false);
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonResponse.cs b/BackEnd/Timeline/Models/Http/CommonResponse.cs
index 3d0ed509..3666ea47 100644
--- a/BackEnd/Timeline/Models/Http/CommonResponse.cs
+++ b/BackEnd/Timeline/Models/Http/CommonResponse.cs
@@ -1,5 +1,3 @@
-using static Timeline.Resources.Models.Http.Common;
-
namespace Timeline.Models.Http
{
public class CommonResponse
@@ -18,113 +16,4 @@ namespace Timeline.Models.Http
public int Code { get; set; }
public string? Message { get; set; }
}
-
- public class CommonDataResponse<T> : CommonResponse
- {
- public CommonDataResponse()
- {
-
- }
-
- public CommonDataResponse(int code, string message, T data)
- : base(code, message)
- {
- Data = data;
- }
-
- public T Data { get; set; } = default!;
- }
-
- public class CommonPutResponse : CommonDataResponse<CommonPutResponse.ResponseData>
- {
- public class ResponseData
- {
- public ResponseData() { }
-
- public ResponseData(bool create)
- {
- Create = create;
- }
-
- public bool Create { get; set; }
- }
-
- public CommonPutResponse()
- {
-
- }
-
- public CommonPutResponse(int code, string message, bool create)
- : base(code, message, new ResponseData(create))
- {
-
- }
-
- internal static CommonPutResponse Create(bool create)
- {
- return new CommonPutResponse(0, MessagePutCreate, create);
- }
-
- internal static CommonPutResponse Create()
- {
- return new CommonPutResponse(0, MessagePutCreate, true);
- }
-
- internal static CommonPutResponse Modify()
- {
- return new CommonPutResponse(0, MessagePutModify, false);
- }
- }
-
- /// <summary>
- /// Common response for delete method.
- /// </summary>
- public class CommonDeleteResponse : CommonDataResponse<CommonDeleteResponse.ResponseData>
- {
- /// <summary></summary>
- public class ResponseData
- {
- /// <summary></summary>
- public ResponseData() { }
-
- /// <summary></summary>
- public ResponseData(bool delete)
- {
- Delete = delete;
- }
-
- /// <summary>
- /// True if the entry is deleted. False if the entry does not exist.
- /// </summary>
- public bool Delete { get; set; }
- }
-
- /// <summary></summary>
- public CommonDeleteResponse()
- {
-
- }
-
- /// <summary></summary>
- public CommonDeleteResponse(int code, string message, bool delete)
- : base(code, message, new ResponseData(delete))
- {
-
- }
-
- internal static CommonDeleteResponse Create(bool delete)
- {
- return new CommonDeleteResponse(0, MessageDeleteDelete, delete);
- }
-
- internal static CommonDeleteResponse Delete()
- {
- return new CommonDeleteResponse(0, MessageDeleteDelete, true);
- }
-
- internal static CommonDeleteResponse NotExist()
- {
- return new CommonDeleteResponse(0, MessageDeleteNotExist, false);
- }
- }
}
diff --git a/BackEnd/Timeline/Models/Http/Resource.Designer.cs b/BackEnd/Timeline/Models/Http/Resource.Designer.cs
new file mode 100644
index 00000000..3e6aaa81
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/Resource.Designer.cs
@@ -0,0 +1,99 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Timeline.Models.Http {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resource {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resource() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Models.Http.Resource", typeof(Resource).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An existent item is deleted..
+ /// </summary>
+ internal static string MessageDeleteDelete {
+ get {
+ return ResourceManager.GetString("MessageDeleteDelete", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The item does not exist, so nothing is changed..
+ /// </summary>
+ internal static string MessageDeleteNotExist {
+ get {
+ return ResourceManager.GetString("MessageDeleteNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A new item is created..
+ /// </summary>
+ internal static string MessagePutCreate {
+ get {
+ return ResourceManager.GetString("MessagePutCreate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An existent item is modified..
+ /// </summary>
+ internal static string MessagePutModify {
+ get {
+ return ResourceManager.GetString("MessagePutModify", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/Resource.resx b/BackEnd/Timeline/Models/Http/Resource.resx
new file mode 100644
index 00000000..85ec4d32
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/Resource.resx
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="MessageDeleteDelete" xml:space="preserve">
+ <value>An existent item is deleted.</value>
+ </data>
+ <data name="MessageDeleteNotExist" xml:space="preserve">
+ <value>The item does not exist, so nothing is changed.</value>
+ </data>
+ <data name="MessagePutCreate" xml:space="preserve">
+ <value>A new item is created.</value>
+ </data>
+ <data name="MessagePutModify" xml:space="preserve">
+ <value>An existent item is modified.</value>
+ </data>
+</root> \ No newline at end of file