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() { Id = 0; AddTime = DateTime.Now; } [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Required()] [Display(Name = "评论者")] public int Operator { get; set; } [Required()] [Display(Name = "内容")] public string Content { get; set; } [Display(Name = "评论时间")] [DataType(DataType.DateTime)] public DateTime AddTime { get; set; } [Display(Name = "被评论者")] public int Student { get; set; } public Comment(int opid, string content, int stuint) { Id = 0; Operator = opid; Content = content; Student = stuint; AddTime = DateTime.Now; } } }