chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace 報到系統客戶端.Data.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 本地 Classes 表資料項目
|
||||
/// 對應後端 DAC_Classes1.cs 的 ClassesItem
|
||||
/// </summary>
|
||||
public class LocalClassesItem
|
||||
{
|
||||
[JsonProperty("ID")]
|
||||
public int ID { get; set; }
|
||||
|
||||
[JsonProperty("CourseCode")]
|
||||
public string CourseCode { get; set; }
|
||||
|
||||
[JsonProperty("CourseName")]
|
||||
public string CourseName { get; set; }
|
||||
|
||||
[JsonProperty("CourseDate")]
|
||||
public string CourseDate { get; set; }
|
||||
|
||||
[JsonProperty("CourseLocation")]
|
||||
public string CourseLocation { get; set; }
|
||||
|
||||
[JsonProperty("NotificationTemplate")]
|
||||
public string NotificationTemplate { get; set; }
|
||||
|
||||
[JsonProperty("AgreedTerms")]
|
||||
public string AgreedTerms { get; set; }
|
||||
|
||||
[JsonProperty("StartTime")]
|
||||
public string StartTime { get; set; }
|
||||
|
||||
[JsonProperty("EndTime")]
|
||||
public string EndTime { get; set; }
|
||||
|
||||
[JsonProperty("CreatedAt")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("UpdatedAt")]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string DisplayText {
|
||||
get {
|
||||
return string.Format("[{0}] ({1:yyyy-MM-dd} {2}) {3} ", CourseCode, CourseDate, StartTime, CourseName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 從後端 API 模型轉換
|
||||
/// </summary>
|
||||
public static LocalClassesItem ConvertFromApiModel(報到系統客戶端.Models.ClassesItem apiModel)
|
||||
{
|
||||
if (apiModel == null) return null;
|
||||
|
||||
return new LocalClassesItem
|
||||
{
|
||||
ID = apiModel.ID,
|
||||
CourseCode = apiModel.CourseCode,
|
||||
CourseName = apiModel.CourseName,
|
||||
CourseDate = apiModel.CourseDate.ToString("yyyy-MM-dd"),
|
||||
CourseLocation = apiModel.CourseLocation,
|
||||
NotificationTemplate = apiModel.NotificationTemplate,
|
||||
AgreedTerms = apiModel.AgreedTerms,
|
||||
StartTime = apiModel.StartTime,
|
||||
EndTime = apiModel.EndTime,
|
||||
CreatedAt = DateTime.Now,
|
||||
UpdatedAt = DateTime.Now
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user