Example #1
0
 public async Task <bool> Delete(int languageId)
 {
     using (languageContext db = new languageContext())
     {
         Language language =
             db.Language.Where(x => x.Id == languageId).FirstOrDefault();
         if (language != null)
         {
             db.Language.Remove(language);
         }
         return(await db.SaveChangesAsync() >= 1);
     }
 }
Example #2
0
 public async Task <bool> Update(LanguageItem languageItem)
 {
     using (languageContext db = new languageContext())
     {
         Language language = db.Language.Where
                                 (x => x.Id == languageItem.Id).FirstOrDefault();
         if (language == null)
         {
             language = new Language()
             {
                 Text = languageItem.Text,
             };
             db.Language.Add(language);
         }
         else
         {
             language.Text = languageItem.Text;
         }
         return(await db.SaveChangesAsync() >= 1);
     }
 }