Esempio n. 1
0
        public bool Update(Files file, FCNDBContext.DataAccessLayer.FCNDBContext context)
        {
            if (context == null)
            {
                return(false);
            }
            context.PDFFiles.Attach(file);
            context.Entry(file).Property(p => p.ModifyDate).IsModified        = true;
            context.Entry(file).Property(p => p.Size).IsModified              = true;
            context.Entry(file).Property(p => p.Size_Abbreviation).IsModified = true;
            context.Entry(file).Property(p => p.IsValid).IsModified           = true;
            try
            {
                int amount = context.SaveChanges();
                if (amount == 1)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(false);
        }
Esempio n. 2
0
 public bool UpdateWithoutCommit(Files file, FCNDBContext.DataAccessLayer.FCNDBContext context)
 {
     if (context == null)
     {
         return(false);
     }
     context.PDFFiles.Attach(file);
     context.Entry(file).Property(p => p.ModifyDate).IsModified        = true;
     context.Entry(file).Property(p => p.Size).IsModified              = true;
     context.Entry(file).Property(p => p.Size_Abbreviation).IsModified = true;
     context.Entry(file).Property(p => p.IsValid).IsModified           = true;
     return(true);
 }
Esempio n. 3
0
        public bool Update(Check check, FCNDBContext.DataAccessLayer.FCNDBContext context)
        {
            if (context == null)
            {
                return(false);
            }
            check.CreateDate = DateTime.Now;// no effect, but måste do it
            context.PDFCheck.Attach(check);

            context.Entry(check).Property(p => p.CheckDirectory).IsModified = true;
            context.Entry(check).Property(p => p.Total).IsModified          = true;
            context.Entry(check).Property(p => p.Valid).IsModified          = true;
            context.Entry(check).Property(p => p.Invalid).IsModified        = true;
            return(SaveChange(context));
        }