Exemple #1
0
 public int Add(Model.FileInfo fileInfo)
 {
     using (var dbContext = new DAL.PhotoContext())
     {
         dbContext.Entry(fileInfo).State = EntityState.Added;
         return dbContext.SaveChanges();
     }
 }
Exemple #2
0
        public int Delete(int id)
        {
            using (var dbContext = new DAL.PhotoContext())
            {
                var fileInfo = (from f in dbContext.FileInfos
                                where f.id == id
                                select new Model.FileInfo
                                {
                                    id = f.id
                                }).FirstOrDefault();

                dbContext.Entry(fileInfo).State = EntityState.Deleted;
                return dbContext.SaveChanges();
            }
        }