public List <GroupDbModel> Load(string userId)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         return(db.GroupDbModels.Where(e => e.UserId == userId).ToList());
     }
 }
Пример #2
0
 public bool Check(Guid id)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         return(!db.GroupDbModels.Where(e => e.Id == id).Any());
     }
 }
 public bool Check(string userId, Guid groupId)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         return(db.GroupDbModels.FirstOrDefault(e => e.UserId == userId && e.Id == groupId) != null);
     }
 }
 public void Insert(GroupDbModel groupDbModel)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         db.GroupDbModels.Add(groupDbModel);
         db.SaveChanges();
     }
 }
 public void Insert(FlashcardDbModel flashcardDbModel)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         db.FlashcardsDbModels.Add(flashcardDbModel);
         db.SaveChanges();
     }
 }
 public bool IsUnique(string foreign, string native, Guid groupId)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         return(!db.FlashcardsDbModels
                .Where(e => e.GroupDbModelId == groupId)
                .Where(e => e.ForeignLanguage == foreign || e.NativeLanguage == native)
                .Any());
     }
 }
        public void Update(FlashcardDbModel input)
        {
            using (var db = new FlashcardDbContextPostgreSQL())
            {
                FlashcardDbModel flashcard = db.FlashcardsDbModels.Find(input.Id, input.PracticeDirection);

                flashcard.CorreactAnsInRow = input.CorreactAnsInRow;
                flashcard.NextPracticeDate = input.NextPracticeDate;

                db.SaveChanges();
            }
        }
Пример #8
0
 public List <FlashcardDbModel> Load(Guid groupId)
 {
     using (var db = new FlashcardDbContextPostgreSQL())
     {
         return(db.FlashcardsDbModels
                .Where(e => e.GroupDbModelId == groupId)
                .Where(e => e.CorreactAnsInRow == null)
                .OrderBy(e => e.NextPracticeDate)
                .Take(5)
                .ToList());
     }
 }