public NccModule Update(NccModule entity) { var oldEntity = _entityRepository.Get(entity.Id); if (oldEntity != null) { using (var txn = _entityRepository.BeginTransaction()) { CopyNewData(oldEntity, entity); _entityRepository.Edit(oldEntity); _entityRepository.SaveChange(); txn.Commit(); } } return(entity); }
/// <summary> /// Execure a raw SQL query /// </summary> /// <param name="query">Raw SQL query</param> /// <returns></returns> public string ExecuteQuery(NccDbQueryText query) { string retVal = ""; using (var txn = _entityRepository.BeginTransaction()) { try { var ret = _entityRepository.ExecuteSqlCommand(query); retVal = ret.ToString(); txn.Commit(); } catch (Exception ex) { txn.Rollback(); } } return(retVal); }