Esempio n. 1
0
 //TODO: This method looks good, but I would say it should be in DAL. What do you think?
 public Task <int> InsertEntity(IEntity entity)
 {
     if (entity is Language)
     {
         return(Db.SqLiteAsyncConnection.InsertAsync(entity));
     }
     else if (entity is Level)
     {
         return(SelectedLanguage.InsertLevel(entity as Level));
     }
     else if (entity is Unit)
     {
         return(selectedLevel.InsertUnit(entity as Unit));
     }
     else if (entity is Lesson)
     {
         return(SelectedUnit.InsertLesson(entity as Lesson));
     }
     return(new Task <int>(() => 0));
 }