Example #1
0
        public bool Delete(EventLog eventLog)
        {
            if (eventLog == null) return false;

            using (var db = new DozpContext())
            {
                db.Entry(eventLog).State = EntityState.Deleted;
                db.SaveChanges();
            }

            return true;
        }
Example #2
0
        public Institution Create(Institution institution)
        {
            if (institution == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(institution).State = EntityState.Added;
                db.SaveChanges();
            }

            return institution;
        }
Example #3
0
        public EventLog Create(EventLog eventLog)
        {
            if (eventLog == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(eventLog).State = EntityState.Added;
                db.SaveChanges();
            }

            return eventLog;
        }
Example #4
0
        public bool Delete(Institution institution)
        {
            if (institution == null) return false;

            using (var db = new DozpContext())
            {
                db.Entry(institution).State = EntityState.Deleted;
                db.SaveChanges();
            }

            return true;
        }
Example #5
0
        public Book Create(Book book)
        {
            if (book == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(book).State = EntityState.Added;
                db.SaveChanges();
            }

            return book;
        }
Example #6
0
        public bool Delete(Book book)
        {
            if (book == null) return false;

            using (var db = new DozpContext())
            {
                db.Entry(book).State = EntityState.Deleted;
                db.SaveChanges();
            }

            return true;
        }
Example #7
0
        public Operation Create(Operation operation)
        {
            if (operation == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(operation).State = EntityState.Added;
                db.SaveChanges();
            }

            return operation;
        }
Example #8
0
        public ScanFile Create(ScanFile scanFile)
        {
            if (scanFile == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(scanFile).State = EntityState.Added;
                db.SaveChanges();
            }

            return scanFile;
        }
Example #9
0
        public bool Delete(ScanFile scanFile)
        {
            if (scanFile == null) return false;

            using (var db = new DozpContext())
            {
                db.ScanFiles.Attach(scanFile);
                db.ScanFiles.Remove(scanFile);
                db.SaveChanges();
            }

            return true;
        }
Example #10
0
        public User Update(User user)
        {
            if (user == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
            }

            return user;
        }
Example #11
0
        public Institution Update(Institution institution)
        {
            if (institution == null) return null;

            //try
            //{
            using (var db = new DozpContext())
            {
                db.Entry(institution).State = EntityState.Modified;
                db.SaveChanges();
            }
            //}
            //catch (DbEntityValidationException ex)
            //{
            //    StringBuilder sb = new StringBuilder();
            //    foreach (var result in ex.EntityValidationErrors)
            //    {
            //        sb.AppendLine(string.Format(ErrorMessage.ENTITY_VALIDATION_ERROR, result.Entry.Entity.GetType().Name, result.Entry.State));
            //        foreach (var error in result.ValidationErrors)
            //        {
            //            sb.AppendLine(String.Format(ErrorMessage.PROPERTY_VALIDATION_ERROR, error.PropertyName, error.ErrorMessage));
            //        }
            //    }
            //    throw new DbEntityValidationException(sb.ToString(), ex);
            //}

            return institution;
        }
Example #12
0
        internal Operation Update(Operation operation)
        {
            if (operation == null) return null;

            using (var db = new DozpContext())
            {
                db.Entry(operation).State = EntityState.Modified;
                db.SaveChanges();
            }

            return operation;
        }
Example #13
0
        internal bool Delete(Operation operation)
        {
            if (operation == null) return false;

            using (var db = new DozpContext())
            {
                db.Entry(operation).State = EntityState.Deleted;
                db.SaveChanges();
            }

            return true;
        }