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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }