2022-09-08 08:04:32 -07:00

85 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Church.Net.Entity.Enumeration;
namespace Church.Net.Entity
{
public class Vocabulary
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public string Word { get; set; }
[Required]
[DataType(DataType.MultilineText)]
public string DefinitionEn { get; set; }
[Required]
[DataType(DataType.MultilineText)]
public string DefinitionCh { get; set; }
public string NounPlural { get; set; }
public string VerbPast { get; set; }
public string VerbParticiple { get; set; }
public PartsOfSpeech PartOfSpeech { get; set; }
public string ImagesUrl { get; set; }
public DateTime InsertDate { get; set; }
public DateTime PracticeDate { get; set; }
public PracticeStage PracticeStage { get; set; }
public bool PracticeSelect { get; set; }
public bool PracticeMemorized { get; set; }
public bool PracticeVisualize { get; set; }
public bool PracticeApply { get; set; }
public bool PracticeReview { get; set; }
[DataType(DataType.MultilineText)]
public string PracticeSentence { get; set; }
public int FlashCardTimes { get; set; }
[NotMapped]
public int PracticeTimes { get; set; }
public string MaskedWord
{
get
{
return GetMaskedWord(Word);
}
}
public string MaskedVerbPast
{
get
{
return GetMaskedWord(VerbPast);
}
}
public string MaskedVerbParticiple
{
get
{
return GetMaskedWord(VerbParticiple);
}
}
private string GetMaskedWord(string word)
{
string reuslt = word.Substring(0, 1);
for (int i = 1; i < word.Length; i++)
{
reuslt = reuslt + " _";
}
reuslt = reuslt + " " + word.Substring(word.Length - 1, 1);
return reuslt;
}
}
}