using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace _2021_backend.Models { public class Comment { public Comment() { Guid = Guid.NewGuid(); AddTime = DateTime.Now; } [Key] public Guid Guid { get; set; } [Required()] [Display(Name ="评论者")] public Guid Operator { get; set; } [Required()] [Display(Name ="内容")] public string Content { get; set; } [Display(Name = "评论时间")] [DataType(DataType.DateTime)] public DateTime AddTime { get; set; } [Display(Name ="被评论者")] public Guid Student { get; set; } public Comment(Guid opid,string content, Guid stuguid) { Guid = Guid.NewGuid(); Operator = opid; Content = content; Student = stuguid; AddTime = DateTime.Now; } } }