Beispiel #1
0
        public async Task <bool> Update([FromBody] WordRequestEntity entity)
        {
            var updatedEntity = new WordEntity
            {
                originalword = entity.word,
                packageId    = entity.packageId,
                description  = entity.description,
                ownSentence  = entity.ownSentence,
                synonym      = entity.synonym,
                _id          = new MongoDB.Bson.ObjectId(entity.id)
            };
            var result = await hubRepository.Update(updatedEntity);

            return(result);
        }
Beispiel #2
0
        public async Task <IActionResult> Add([FromBody] WordRequestEntity word)
        {
            var result = await hubRepository.Add(new WordEntity
            {
                _id            = ObjectId.GenerateNewId(),
                originalword   = word.word,
                description    = word.description,
                userId         = word.userId,
                packageId      = word.packageId,
                synonym        = word.synonym,
                lexialCategory = word.lexialCategory,
                definition     = word.definition,
                ownSentence    = word.ownSentence
            });

            return(Ok(result));
        }