Пример #1
0
 public void UpdateRankByKeywordNFileID(Guid fileID, String keyword, double newRankVal)
 {
     using (DockerDBEntities dockerEntities = new DockerDBEntities()) {
         DCE_Keywords dCE_Keywords = (from p in dockerEntities.DCE_Keywords
                                      where p.FileID == fileID && p.Keyword == keyword
                                      select p).First();
         dCE_Keywords.Rank = (float)newRankVal;
         dockerEntities.SaveChanges();
     }
 }
Пример #2
0
 public bool DeleteKeyword(Guid fileID, Guid userID, String keyword)
 {
     using (DockerDBEntities dockerEntities = new DockerDBEntities()) {
         DCE_Keywords dCE_Keywords = (from p in dockerEntities.DCE_Keywords
                                      where p.FileID == fileID && p.Keyword == keyword
                                      select p).FirstOrDefault();
         if (dCE_Keywords != null)
         {
             dockerEntities.DCE_Keywords.Remove(dCE_Keywords);
             dockerEntities.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
Пример #3
0
 public bool InsertKeyword(Guid fileID, Guid userID, String keyword, double rank)
 {
     using (DockerDBEntities dockerEntities = new DockerDBEntities()) {
         DCE_Keywords dCE_Keywords = (from p in dockerEntities.DCE_Keywords
                                      where p.FileID == fileID && p.Keyword == keyword && p.UserID == userID
                                      select p).FirstOrDefault();
         if (dCE_Keywords == null)
         {
             dockerEntities.DCE_Keywords.Add(new DCE_Keywords()
             {
                 FileID  = fileID,
                 UserID  = userID,
                 Keyword = keyword,
                 Rank    = (float)rank
             });
             dockerEntities.SaveChanges();
             return(true);
         }
         return(false);
     }
 }