exam_service
This commit is contained in:
@@ -15,10 +15,9 @@ namespace Entities.Contracts
|
||||
[Column("id")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("assignment")]
|
||||
[ForeignKey("Assignment")]
|
||||
public Guid AssignmentId { get; set; }
|
||||
public Guid? AssignmentId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("title")]
|
||||
@@ -31,7 +30,7 @@ namespace Entities.Contracts
|
||||
|
||||
|
||||
[Column("total_points")]
|
||||
public decimal? TotalPoints { get; set; }
|
||||
public float? TotalPoints { get; set; }
|
||||
|
||||
[Column("number")]
|
||||
public byte Number { get; set; }
|
||||
@@ -42,9 +41,12 @@ namespace Entities.Contracts
|
||||
[Column("deleted")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
[Column("valid_question_group")]
|
||||
public bool ValidQuestionGroup { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public Assignment Assignment { get; set; }
|
||||
public AssignmentGroup ParentAssignmentGroup { get; set;}
|
||||
public Assignment? Assignment { get; set; }
|
||||
public AssignmentGroup? ParentAssignmentGroup { get; set;}
|
||||
public ICollection<AssignmentGroup> ChildAssignmentGroups { get; set; }
|
||||
public ICollection<AssignmentQuestion> AssignmentQuestions { get; set; }
|
||||
|
||||
|
@@ -21,21 +21,23 @@ namespace Entities.Contracts
|
||||
[ForeignKey("Question")]
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("group_id")]
|
||||
[ForeignKey("AssignmentGroup")]
|
||||
public Guid AssignmentGroupId { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
[Column("question_number")]
|
||||
public byte QuestionNumber { get; set; }
|
||||
|
||||
|
||||
[Column("created_at")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[Column("score")]
|
||||
public float? Score { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("detail_id")]
|
||||
[ForeignKey("AssignmentGroup")]
|
||||
public Guid AssignmentGroupId { get; set; }
|
||||
|
||||
[Column("deleted")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
|
@@ -50,6 +50,9 @@ namespace Entities.Contracts
|
||||
[Column("deleted")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
[Column("valid_question")]
|
||||
public bool ValidQuestion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public User Creator { get; set; }
|
||||
public ICollection<AssignmentQuestion> AssignmentQuestions { get; set; }
|
||||
|
@@ -3,21 +3,47 @@
|
||||
public class ApiResponse
|
||||
{
|
||||
public ApiResponse(string message, bool status = false)
|
||||
{
|
||||
this.Message = message;
|
||||
this.Status = status;
|
||||
}
|
||||
: this(status, message, null) { }
|
||||
|
||||
|
||||
public ApiResponse(bool status, object result)
|
||||
: this(status, string.Empty, result) { }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个表示成功响应的 ApiResponse 实例。
|
||||
/// </summary>
|
||||
/// <param name="message">成功消息。</param>
|
||||
/// <param name="result">可选的返回数据。</param>
|
||||
/// <returns>ApiResponse 实例。</returns>
|
||||
public static ApiResponse Success(string message = "操作成功。", object? result = null)
|
||||
{
|
||||
this.Status = status;
|
||||
this.Result = result;
|
||||
return new ApiResponse(true, message, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个表示失败响应的 ApiResponse 实例。
|
||||
/// </summary>
|
||||
/// <param name="message">错误消息。</param>
|
||||
/// <param name="result">可选的错误详情或数据。</param>
|
||||
/// <returns>ApiResponse 实例。</returns>
|
||||
public static ApiResponse Error(string message = "操作失败。", object? result = null)
|
||||
{
|
||||
return new ApiResponse(false, message, result);
|
||||
}
|
||||
|
||||
public ApiResponse()
|
||||
{
|
||||
}
|
||||
|
||||
private ApiResponse(bool status, string message, object? result)
|
||||
{
|
||||
Status = status;
|
||||
Message = message;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public bool Status { get; set; }
|
||||
|
@@ -3,31 +3,33 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public class ExamDto
|
||||
{
|
||||
public Guid? AssignmentId { get; set; }
|
||||
public string CreaterEmail { get; set; }
|
||||
public string AssignmentTitle { get; set; } = string.Empty;
|
||||
public string Description { get; set; }
|
||||
public string SubjectArea { get; set; }
|
||||
public List<QuestionGroupDto> QuestionGroups { get; set; } = new List<QuestionGroupDto>();
|
||||
public QuestionGroupDto QuestionGroups { get; set; } = new QuestionGroupDto();
|
||||
}
|
||||
|
||||
public class QuestionGroupDto
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public byte Index { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string? Title { get; set; }
|
||||
|
||||
public int Score { get; set; }
|
||||
|
||||
public string QuestionReference { get; set; }
|
||||
public float Score { get; set; }
|
||||
|
||||
public string? Descript { get; set; }
|
||||
public List<SubQuestionDto> SubQuestions { get; set; } = new List<SubQuestionDto>();
|
||||
|
||||
public List<QuestionGroupDto> SubQuestionGroups { get; set; } = new List<QuestionGroupDto>();
|
||||
public bool ValidQuestionGroup { get; set; } = false;
|
||||
}
|
||||
|
||||
public class SubQuestionDto
|
||||
@@ -35,16 +37,17 @@ namespace Entities.DTO
|
||||
|
||||
public byte Index { get; set; }
|
||||
|
||||
public string Stem { get; set; }
|
||||
public string? Stem { get; set; }
|
||||
|
||||
public float Score { get; set; }
|
||||
|
||||
public List<OptionDto> Options { get; set; } = new List<OptionDto>();
|
||||
|
||||
public string SampleAnswer { get; set; }
|
||||
public string? SampleAnswer { get; set; }
|
||||
|
||||
public string QuestionType { get; set; }
|
||||
public string DifficultyLevel { get; set; }
|
||||
public string? QuestionType { get; set; }
|
||||
public string? DifficultyLevel { get; set; }
|
||||
public bool ValidQuestion { get; set; } = false;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user