Пример #1
0
 internal static IList <MediabankFile> GetAllFilesWithType(int clubId, string fileType)
 {
     using (MediabankEntities db = new MediabankEntities())
     {
         return(db.MediabankFile.Where(m => m.ClubId == clubId && m.FileType == fileType).ToList());
     }
 }
Пример #2
0
 internal static MediabankFile GetFile(int clubId, int fileId)
 {
     using (MediabankEntities db = new MediabankEntities())
     {
         return(db.MediabankFile.Where(m => m.ClubId == clubId && m.Id == fileId).FirstOrDefault());
     }
 }
Пример #3
0
 internal static IList <MediabankFile> GetAllFiles(int clubId)
 {
     using (MediabankEntities db = new MediabankEntities())
     {
         return(db.MediabankFile.Where(m => m.ClubId == clubId).ToList());
     }
 }
Пример #4
0
        internal static bool DeleteMediabankFile(MediabankFile mediabankFile)
        {
            using (MediabankEntities db = new MediabankEntities())
            {
                try
                {
                    db.Entry(mediabankFile).State = System.Data.Entity.EntityState.Deleted;
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    LogHelper.LogError($"", ex, mediabankFile.ClubId);
                }

                return(false);
            }
        }
Пример #5
0
        internal static MediabankFile SaveFile(MediabankFile mbFile)
        {
            using (MediabankEntities db = new MediabankEntities())
            {
                try
                {
                    db.MediabankFile.Add(mbFile);
                    db.SaveChanges();
                    return(mbFile);
                }
                catch (Exception ex)
                {
                    LogHelper.LogError($"", ex, mbFile.ClubId);
                }

                return(null);
            }
        }