Example #1
0
        public void DeleteFile(int FileId)
        {
            PresentationFiles dbEntry = context.PresentationFiles
                                        .FirstOrDefault(f => f.FileId == FileId);

            if (dbEntry != null)
            {
                context.PresentationFiles.Remove(dbEntry);
                context.SaveChanges();
            }
        }
Example #2
0
 //files
 public void SaveFile(PresentationFiles file)
 {
     if (file.FileId == 0)
     {
         file.CreatedAt = DateTime.Now;
         file.UpdatedAt = DateTime.Now;
         context.PresentationFiles.Add(file);
     }
     else
     {
         PresentationFiles dbEntry = context.PresentationFiles
                                     .FirstOrDefault(f => f.FileId == file.FileId);
         if (dbEntry != null)
         {
             dbEntry.UpdatedAt = DateTime.Now;
             dbEntry.Title     = file.Title;
             dbEntry.Part      = file.Part;
             dbEntry.FilePath  = file.FilePath;
         }
     }
     context.SaveChanges();
 }