Пример #1
0
 public string UpdateDictionary([FromBody] VmWord[] words)
 {
     using (var db = new DictionaryContext())
     {
         foreach (VmWord word in words)
         {
             if (word == null)
             {
                 return("word = null");
             }
             db.Words.Update(word);
             Console.WriteLine("Updating word \"{0}\" id {1}", word.Name_en, word.Id);
         }
         db.SaveChanges();
     }
     return("succes");
 }
Пример #2
0
        public async Task <VmWord[]> GetDictionary()
        {
            VmWord[] words;
            DateTime dateToday = DateTime.Now;

            UpdateSchedule();

            using (var db = new DictionaryContext())
            {
                words = db.Words.Where(p => p.NextRepeatDate <= dateToday).ToArray();
            }

            return(await Task <VmWord[]> .Factory.StartNew(() =>
            {
                return words;
            }));
        }