예제 #1
0
 //Post: Edit
 public static void EditPage(Page page)
 {
     if (page != null)
     {
         using (var db = new ApplicationDbContext())
         {
             //try
             //{
                 db.Entry(page).State = EntityState.Modified;
                 db.SaveChanges();
         //}
         //    catch (Exception ex) when (ex is DbUpdateException ||
         //                             ex is DbEntityValidationException ||
         //                             ex is NotSupportedException ||
         //                             ex is ObjectDisposedException ||
         //                             ex is InvalidOperationException)
         //{
         //    ErrorHelpers.LogError(ex, ErrorLevel.Error, "Error on write in database");
         //}
     }
     }
 }
예제 #2
0
        //Metode

        public static void Create(string finalFilePath, int DocumentId, int pageNumber)
        {
            using (var db = new ApplicationDbContext())
            {
                Page page = new Page();
                page.DocumentId = DocumentId;
                page.PageNumber = pageNumber;
                page.PagePath = finalFilePath;

                //try
                //{
                    db.Pages.Add(page);
                    db.SaveChanges();
                //}
                //catch (Exception ex) when (ex is DbUpdateException ||
                //                              ex is DbEntityValidationException ||
                //                              ex is NotSupportedException ||
                //                              ex is ObjectDisposedException ||
                //                              ex is InvalidOperationException)
                //{
                //    ErrorHelpers.LogError(ex, ErrorLevel.Error, "Error on write in database");
                //}
            }
        }