Exemplo n.º 1
0
 public WordSuite Map(WordSuiteModel wordSuite)
 {
     if (wordSuite == null)
     {
         throw new ArgumentNullException("wordSuite");
     }
     return(new WordSuite()
     {
         Name = wordSuite.Name,
         LanguageId = wordSuite.LanguageId,
         OwnerId = wordSuite.OwnerId,
         PrototypeId = wordSuite.PrototypeId,
         Threshold = wordSuite.Threshold,
         QuizResponseTime = wordSuite.QuizResponseTime
     });
 }
Exemplo n.º 2
0
 public WordSuite Map(WordSuiteModel wordSuite)
 {
     if (wordSuite == null)
     {
         throw new ArgumentNullException("wordSuite");
     }
     return new WordSuite()
     {
         Name = wordSuite.Name,
         LanguageId = wordSuite.LanguageId,
         OwnerId = wordSuite.OwnerId,
         PrototypeId = wordSuite.PrototypeId,
         Threshold = wordSuite.Threshold,
         QuizResponseTime = wordSuite.QuizResponseTime
     };
 }
        public IHttpActionResult Post(WordSuiteModel wordSuite)
        {
            if (wordSuite == null)
            {
                throw new ArgumentNullException("wordSuite", "WordSuite can't be null");
            }

            int wordSuiteId = wordSuiteService.Add(wordSuiteMapper.Map(wordSuite));

            if (wordSuiteId <= 0)
            {
                return BadRequest("Failed to add WordSuite");
            }

            if (wordSuite.WordTranslationsId.Count > 0)
            {
                if (!wordProgressService.AddRange(wordProgressMapper.MapRange(wordSuiteId, wordSuite.WordTranslationsId)))
                {
                    return BadRequest("Failed to add WordTranslations");
                }
            }

            return Ok();
        }