-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefinitionBuilder.cs
46 lines (39 loc) · 1.24 KB
/
DefinitionBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using VkCore.Constants;
using VkCore.Interfaces;
using VkCore.Models.Word;
namespace VkCore.Builders
{
public class DefinitionBuilder : IAnnotationBuilder
{
private readonly Annotation _annotation;
public DefinitionBuilder(string wordEntryId)
{
_annotation = new Annotation(wordEntryId);
}
public void SetContent(string definition, string partOfSpeech, string imageUrl = null)
{
_annotation.Type = AnnotationType.Definition;
_annotation.Value = definition;
_annotation.PartOfSpeech = partOfSpeech;
_annotation.ImageUrl = imageUrl;
}
public void AddExampleSentence(string exampleSentence, string readingId)
{
_annotation.AddContext(exampleSentence, readingId);
}
public void SetSource(string source, string createUserId)
{
if (source == DefinitionSourceTypes.UserCode)
{
_annotation.UpdatedBy = createUserId;
_annotation.UpdateDate = DateTime.UtcNow;
}
_annotation.Source = source;
}
public Annotation GetAnnotation()
{
return _annotation;
}
}
}